internal void RemoveAircraft(Aircraft aircraft) { AircraftsWithRelPositions.Remove(aircraft); aircraft.Squadron = null; if (aircraft == Leader) // the old leader is gone, select a new one (only pro forma, since the formation should be broken by this point) { Leader = AircraftsWithRelPositions.Any() ? AircraftsWithRelPositions.Keys.First() : null; } }
internal void AddAircraft(Aircraft aircraft, CCPoint formationPos) { aircraft.Team = Team.EnemyTeam; // since squadrons are only for enemies aircraft.Squadron = this; AircraftsWithRelPositions.Add(aircraft, formationPos); if (Leader == null) { Leader = aircraft; } // check if you have to adapt the velocity float v = aircraft.MaxVelocity * 0.9f; if (v < Velocity) { Velocity = v; } }