Grid::grid_ptr Grid::OnPass(Plane& plane, int& left_point, int reason) { grid_ptr move_to; if (left_point > 0) { --left_point; move_to = GetNextGrid(); } if (left_point < 0) { ++left_point; move_to = GetPreviousGrid(); } // 添加飞机运动动画 MoveHere(plane, plane.GetSpeed(), 0.0f, reason); if (!move_to) return GridPool::Find(ID()); return move_to; }
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); } // 胜利条件 }