Beispiel #1
0
 /// <summary>
 /// Check if player have collided with coin
 /// </summary>
 /// <param name="soundObserver"></param>
 private void CheckIfPlayerPickedUpCoin(ISoundObserver soundObserver, IPickUpObserver pickUpObserver)
 {
     for (int i = 0; i < m_coinList.Count; i++)
     {
         if (CollisionHandler.IsCollidingWithCoin(m_player, m_coinList[i]))
         {
             pickUpObserver.PlayerPickUpCoinAt(m_coinList[i].Position);
             m_coinList.Remove(m_coinList[i]);
             soundObserver.PlayerPickUpCoin();
         }
     }
 }
Beispiel #2
0
        public void Update(float totalElapsedSeconds, ISoundObserver soundObserver, IPickUpObserver pickUpObserver)
        {
            if (CanPlayerMoveRight())
            {
                UpdatePlayer(totalElapsedSeconds);
            }

            else
            {
                MoveLeft();
                UpdatePlayer(totalElapsedSeconds);
            }

            UpdateBomb(totalElapsedSeconds);

            CheckIfInHole(soundObserver);
            CheckIfCollideWithBomb(soundObserver);
            CheckIfDead();
            CheckIfLevelFinished(soundObserver);
            CheckIfPlayerPickedUpCoin(soundObserver, pickUpObserver);
        }