Exemple #1
0
 //Updates AI position and collected orbs
 public void UpdateAI()
 {
     foreach (AIShip aI in AIShips.ToList())
     {
         UpdateGravity(aI);
         aI.AIMove();
         Well well = aI.WellOver();
         if (well != null)
         {
             int originalColor = well.Orbs;
             if (!well.IsStable)
             {
                 if (well.IsTrap && well.Owner == Player)
                 {
                     Points += 200;
                 }
                 int objIndex = AIShips.FindIndex(item => item.Equals(aI));
                 UpdateAnimationEvent(this, new AnimationEventArgs(false, AnimationType.AI, objIndex, 8, 0));
                 AIShips.Remove(aI);
                 GameObjects.Remove(aI);
             }
             else if (aI.DepositOrbs(well))
             {
                 int objIndex = StableWells.FindIndex(item => item.Equals(well));
                 UpdateAnimationEvent(this, new AnimationEventArgs(false, AnimationType.Stable, objIndex, 12, 0));
                 StableWells.Remove(well);
                 GameObjects.Remove(well);
                 aI.GamePowerup.AddNew();
                 aI.SetTargetPos();
             }
             else if (well.Orbs != originalColor)
             {
                 int objIndex = StableWells.FindIndex(item => item.Equals(well));
                 UpdateAnimationEvent(this, new AnimationEventArgs(true, AnimationType.Stable, objIndex, well.Orbs, 6 + well.Orbs));
             }
         }
         Orb orb = aI.OrbOver();
         if (orb != null)
         {
             if (aI.Orbs.Count < 5)
             {
                 Orbs.Remove(orb);
                 GameObjects.Remove(orb);
                 aI.Orbs.Add(orb.Color);
                 aI.Orbs.Sort();
                 aI.SetTargetPos();
             }
         }
         aI.UseNeutralize();
         aI.UseDestabilize();
         aI.UseGhost();
     }
 }
Exemple #2
0
 //Updates AI position and collected orbs
 public void UpdateAI()
 {
     foreach (AIShip aI in AIShips.ToList())
     {
         UpdateGravity(aI);
         aI.AIMove();
         Well well = aI.WellOver();
         if (well != null)
         {
             if (!well.IsStable)
             {
                 if (well.IsTrap)
                 {
                     well.PlayerWhoSetTrap.Points += 200;
                 }
                 AIShips.Remove(aI);
                 GameObjects.Remove(aI);
             }
             else if (aI.DepositOrbs(well) && !well.IsGhost)
             {
                 StableWells.Remove(well);
                 GameObjects.Remove(well);
                 aI.GamePowerup.AddNew();
                 aI.SetTargetPos();
             }
         }
         Orb orb = aI.OrbOver();
         if (orb != null)
         {
             if (aI.Orbs.Count < 5)
             {
                 Orbs.Remove(orb);
                 GameObjects.Remove(orb);
                 aI.Orbs.Add(orb.Color);
                 aI.Orbs.Sort();
                 aI.SetTargetPos();
             }
         }
         aI.UseNeutralize();
         aI.UseDestabilize();
         aI.UseGhost();
     }
 }