Esempio n. 1
0
 public bool Advance(float dt)
 {
     TimeAlive += dt;
     if (IsAlive())
     {
         var oldPos = Position;
         PositionX += Dx * dt;
         PositionY += Dy * dt;
         ((CollisionTypeLine)CollisionType).StartPoint = oldPos;
         ((CollisionTypeLine)CollisionType).EndPoint   = Position;
         // check for collision
         foreach (var aircraft in (MyTeam == Team.PlayerTeam ? ((PlayLayer)Parent).ActiveAircrafts : ((PlayLayer)Parent).PlayerAircrafts))
         {
             if (aircraft.MyState == Aircraft.State.ACTIVE && aircraft.Team.IsEnemy(MyTeam))
             {
                 if (Collisions.CollideBoundingBoxLine(aircraft, (CollisionTypeLine)CollisionType))
                 {
                     CollideWithAircraft(aircraft);
                 }
             }
         }
     }
     return(CanBeRemoved());
 }