Exemplo n.º 1
0
 private void DecrementLives(int livesToLose)
 {
     _currentGameStatistics.Lives -= livesToLose;
     OnLivesChanged?.Invoke(_currentGameStatistics.Lives.ToString());
     if (_currentGameStatistics.Lives <= 0)
     {
         GameOver();
     }
 }
Exemplo n.º 2
0
    public virtual void UpdateLives(int lives)
    {
        OnLivesChangedEventArgs args = new OnLivesChangedEventArgs()
        {
            NewLives = lives
        };

        OnLivesChanged.Invoke(this, args);
    }
 public void TakeDamage()
 {
     lives--;
     OnLivesChanged?.Invoke(lives);
     Respawn();
     if (lives == 0)
     {
         OnPlayerDeath?.Invoke();
     }
 }
    private void Start()
    {
        _multiplier      = 1;
        _currentLives    = _maxLives - 2;
        _score           = 0;
        _scoreLabel.text = _score.ToString();

        OnLivesChanged?.Invoke(_currentLives);

        _countUserfulInLevel = FindObjectsOfType <Userful>().Length;
    }
    public void OnTouchMortalBubble()
    {
        _touchUnUserfulBubble = true;

        _currentLives--;

        if (_currentLives < 1)
        {
            OnEndLevel?.Invoke(false);
        }

        OnLivesChanged?.Invoke(_currentLives);
    }
Exemplo n.º 6
0
        private void DecrementLives(int livesToLose)
        {
            if (_gameOver)
            {
                return;
            }

            _curGameStatistics.Lives -= livesToLose;
            OnLivesChanged?.Invoke(_curGameStatistics.Lives);
            if (_curGameStatistics.Lives <= 0)
            {
                BeginGameOver();
            }
        }
Exemplo n.º 7
0
    public void KillPlayer()
    {
        Lives--;
        OnLivesChanged?.Invoke(Lives);

        if (Lives <= 0)
        {
            RestartGame();
        }
        else
        {
            SendPlayerToCheckpoint();
        }
    }
Exemplo n.º 8
0
 private void Move()
 {
     Vector   = ChangeDirection(Direction);
     Distance = Distance + GetDelta(Vector);
     PosX     = PosX + Vector.X;
     PosY     = PosY + Vector.Y;
     Lives--;
     if (Lives <= 0)
     {
         timeout.Stop();
     }
     else
     {
         OnLivesChanged?.Invoke(this, Direction, PosX, PosY);
     }
 }
Exemplo n.º 9
0
    public void SetLives(int lives)
    {
        _currentLives = lives;

        if (_currentLives <= 0)
        {
            _currentLives = 0;
            GameManager.Instance.SetGameState(GameState.GameOver);
        }

        if (_currentLives >= MaxLives)
        {
            _currentLives = MaxLives;
        }

        OnLivesChanged?.Invoke(_currentLives);
    }
Exemplo n.º 10
0
 private void UpdateLives(int delta)
 {
     CurrentLives += delta;
     OnLivesChanged?.Invoke();
 }
 public void OnTouchSparingBubble()
 {
     _touchUnUserfulBubble = true;
     _currentLives++;
     OnLivesChanged?.Invoke(_currentLives);
 }
Exemplo n.º 12
0
 private void InitializeUI()
 {
     OnRoundChanged?.Invoke(_curGameStatistics.Rounds);
     OnMoneyChanged?.Invoke(_curGameStatistics.Money);
     OnLivesChanged?.Invoke(_curGameStatistics.Lives);
 }
Exemplo n.º 13
0
 private void InitializeUI()
 {
     OnRoundChanged?.Invoke(_currentGameStatistics.Rounds.ToString());
     OnMoneyChanged?.Invoke(_currentGameStatistics.Money.ToString());
     OnLivesChanged?.Invoke(_currentGameStatistics.Lives.ToString());
 }