Exemple #1
0
    void FlyGrid::arrive_event(Plane& plane, Plane* old_plane) {
        if (Color() == plane.Color() && plane.CanFly() && jump != ID()) {

            auto cross_grid = GetCrossGrid();
            if (cross_grid)
                cross_grid->OnCross(plane, old_plane, GridPool::Find(ID()), GetJumpGrid());

            plane.FlyTo(jump);
        }
    }
Exemple #2
0
    void Grid::OnArrive(Plane& plane, int reason) {
        Plane* old_place_plane = place_plane;
        // 添加飞机运动动画
        MoveHere(plane, plane.GetSpeed(), 0.0f, reason);

        // 击毁已有的Plane
        if (NULL != old_place_plane) {
            // 被击毁飞机回家
            old_place_plane->GoHome(LGR_KICKOFF, plane.GetActionTime());
        }
        place_plane = &plane;


        arrive_event(plane, old_place_plane);

        // 计算跳跃
        if (Color() == plane.Color() && plane.CanJump() && jump != ID()) {
            // 跳跃动画
            plane.JumpTo(jump);
        }

        // 胜利条件
    }