예제 #1
0
        //This method updates the player's position and what orbs it has.
        public void UpdatePlayer()
        {
            if (!IsCheat)
            {
                UpdateGravity(Player);
            }
            Player.Move(HorizontalInput, VerticalInput);
            Well well = Player.WellOver();

            if (well != null)
            {
                int originalColor = well.Orbs;
                if (!well.IsStable)
                {
                    if (!IsCheat && !Player.IsImmune)
                    {
                        IsOver = true;
                        Timer.Stop();
                    }
                }
                else if (Player.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);
                    Player.GamePowerup.AddNew();
                    Points += 100;
                }
                else if (well.Orbs != originalColor)
                {
                    GameInvokeSoundEvent(this, SoundEffect.OrbDrop);
                    int objIndex = StableWells.FindIndex(item => item.Equals(well));
                    UpdateAnimationEvent(this, new AnimationEventArgs(true, AnimationType.Stable, objIndex, well.Orbs, 6 + well.Orbs));
                }
            }
            Orb orb = Player.OrbOver();

            if (orb != null)
            {
                if (Player.Orbs.Count < 5)
                {
                    Orbs.Remove(orb);
                    GameObjects.Remove(orb);
                    Player.Orbs.Add(orb.Color);
                    Player.Orbs.Sort();
                    GameInvokeSoundEvent(this, SoundEffect.OrbGrab);
                }
            }
            if (Player.ImmuneTicksLeft > 0)
            {
                --Player.ImmuneTicksLeft;
            }
            if (Player.ImmuneTicksLeft == 0)
            {
                Player.IsImmune = false;
            }
        }
예제 #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)
         {
             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();
     }
 }
예제 #3
0
        //This method updates the player's position and what orbs it has.
        public void UpdatePlayer(Ship Player)
        {
            UpdateGravity(Player);
            Player.Move();
            Well well = Player.WellOver();

            if (well != null)
            {
                int originalColor = well.Orbs;
                if (!well.IsStable)
                {
                    if (!Player.IsImmune)
                    {
                        Player.Die();
                    }
                }
                else if (Player.DepositOrbs(well))
                {
                    StableWells.Remove(well);
                    GameObjects.Remove(well);
                    Player.GamePowerup.AddNew();
                    Player.Points += 100;
                }
            }
            Orb orb = Player.OrbOver();

            if (orb != null)
            {
                if (Player.Orbs.Count < 5)
                {
                    Orbs.Remove(orb);
                    GameObjects.Remove(orb);
                    Player.Orbs.Add(orb.Color);
                    Player.Orbs.Sort();
                }
            }
            if (Player.ImmuneTicksLeft > 0)
            {
                --Player.ImmuneTicksLeft;
            }
            if (Player.ImmuneTicksLeft == 0)
            {
                Player.IsImmune = false;
            }
        }
예제 #4
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();
     }
 }
예제 #5
0
        //This method deposits all of the orbs it can into a given well.
        public bool DepositOrbs(Well well)
        {
            bool completed = false;

            foreach (int orb in Orbs.ToList())
            {
                if (orb == well.Orbs)
                {
                    if (well.Orbs == 5)
                    {
                        completed = true;
                    }
                    else
                    {
                        well.Orbs++;
                    }
                    IncrementScore();
                    Orbs.Remove(orb);
                    well.TicksLeft = ParentGame.WellDestabFreq;
                }
            }
            return(completed);
        }
예제 #6
0
        //This method deposits all of the orbs it can into a given well.
        public bool DepositOrbs(Well well)
        {
            bool completed = false;

            foreach (int orb in Orbs.ToList())
            {
                if (orb == well.Orbs && (!well.IsGhost || this == well.Owner))
                {
                    if (well.Orbs == 5)
                    {
                        completed = true;
                    }
                    well.Orbs++;
                    IncrementScore();
                    Orbs.Remove(orb);
                    well.TicksLeft = ParentGame.WellDestabFreq;
                }
            }
            if (well.Orbs == 6)
            {
                well.Orbs = 5;
            }
            return(completed);
        }