private void Awake() { _playerInputController = GetComponent <PlayerInputController>(); var brickFactoryGameObject = Instantiate(_brickFactoryPrefab); brickFactoryGameObject.name = _brickFactoryPrefab.name; _brickFactory = brickFactoryGameObject.GetComponent <BrickFactory>(); var ballFactoryGameObject = Instantiate(_ballFactoryPrefab); ballFactoryGameObject.name = _ballFactoryPrefab.name; _ballFactory = ballFactoryGameObject.GetComponent <BallFactory>(); _bricksController = new BricksController(); _bricksController.BrickHit += OnBrickHit; _bricksController.BrickDestroyed += OnBrickDestroy; _livesController = new LivesController(); _scoreController = new ScoreController(); _levelController = new LevelController(); _stateMachine = new BreakoutGameStateMachine(); }
private void OnBrickDestroy(Brick brick) { ScoreController.AddScore(brick.Score); BeatLevelIfNoBricks(); }