public void AddObstacleDestroying() { ++_alreadyDestroyedObstacles; OnWinConditionValueChanged?.Invoke(_alreadyDestroyedObstacles); if (_alreadyDestroyedObstacles >= _destroyedObstaclesToWin) { OnPlayerWin(); } }
private void Start() { OnWinConditionValueChanged?.Invoke(_alreadyDestroyedObstacles); if (_controller == null) { _controller = FindObjectOfType <UIViewController>(); } if (_player == null) { _player = FindObjectOfType <Player>(); } _playerDestroyable = _player.GetComponent <Destroyable>(); _playerDestroyable.OnDeath += OnPlayerDeath; }