private void DecrementLives(int livesToLose) { _currentGameStatistics.Lives -= livesToLose; OnLivesChanged?.Invoke(_currentGameStatistics.Lives.ToString()); if (_currentGameStatistics.Lives <= 0) { GameOver(); } }
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); }
private void DecrementLives(int livesToLose) { if (_gameOver) { return; } _curGameStatistics.Lives -= livesToLose; OnLivesChanged?.Invoke(_curGameStatistics.Lives); if (_curGameStatistics.Lives <= 0) { BeginGameOver(); } }
public void KillPlayer() { Lives--; OnLivesChanged?.Invoke(Lives); if (Lives <= 0) { RestartGame(); } else { SendPlayerToCheckpoint(); } }
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); } }
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); }
private void UpdateLives(int delta) { CurrentLives += delta; OnLivesChanged?.Invoke(); }
public void OnTouchSparingBubble() { _touchUnUserfulBubble = true; _currentLives++; OnLivesChanged?.Invoke(_currentLives); }
private void InitializeUI() { OnRoundChanged?.Invoke(_curGameStatistics.Rounds); OnMoneyChanged?.Invoke(_curGameStatistics.Money); OnLivesChanged?.Invoke(_curGameStatistics.Lives); }
private void InitializeUI() { OnRoundChanged?.Invoke(_currentGameStatistics.Rounds.ToString()); OnMoneyChanged?.Invoke(_currentGameStatistics.Money.ToString()); OnLivesChanged?.Invoke(_currentGameStatistics.Lives.ToString()); }