Exemplo n.º 1
0
 public void Update(float deltaT)
 {
     for (int i = 0; i < _pairs.Count; i++)
     {
         _pairs[i].XPosition -= deltaT * 250;
         if (_pairs[i].Right < 0)
         {
             _pairs.RemoveAt(i);
         }
         if (_pairs[i].Right > _player.Position.X && _pairs[i].Left < _player.Position.X &&
             !(_pairs[i].Top <_player.Position.Y && _pairs[i].Bottom> _player.Position.Y))
         {
             OnPlayerHitObstacle?.Invoke();
         }
     }
     _timeForNextObstacle -= deltaT;
     if (_timeForNextObstacle < 0)
     {
         SpawnObstacles();
     }
 }
Exemplo n.º 2
0
 public static void OnPlayerHitObstacleFunction()
 {
     OnPlayerHitObstacle?.Invoke();
 }