Пример #1
0
 private void Awake()
 {
     _interactiveObject = new ListInteractableObject();
     _displayEndGame    = new DisplayEndGame(_finishGameLabel);
     foreach (var o in _interactiveObject)
     {
         if (o is BadBonus badBonus)
         {
             badBonus.CaughtPlayer += CaughtPlayer;
             badBonus.CaughtPlayer += _displayEndGame.GameOver;
         }
     }
 }
Пример #2
0
        private void Awake()
        {
            _interactiveObject = new ListExecuteObject();

            _reference = new Reference();

            PlayerBase player = null;

            if (PlayerType == PlayerType.Ball)
            {
                player = _reference.PlayerBall;
            }

            _cameraController = new CameraController(player.transform, _reference.MainCamera.transform);
            _interactiveObject.AddExecuteObject(_cameraController);

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                _inputController = new InputController(player);
                _interactiveObject.AddExecuteObject(_inputController);
            }

            _displayEndGame    = new DisplayEndGame(_reference.EndGame);
            _displayBonuses    = new DisplayBonuses(_reference.Bonuse);
            _displayFinishGame = new DisplayFishGame(_reference.FinishGame);

            foreach (var o in _interactiveObject)
            {
                if (o is BadBonus badBonus)
                {
                    badBonus.OnCaughtPlayerChange += CaughtPlayer;
                    badBonus.OnCaughtPlayerChange += _displayEndGame.GameOver;
                }

                if (o is GoodBonus goodBonus)
                {
                    goodBonus.OnPointChange += AddBonuse;
                }
                if (o is Finish finish)
                {
                    finish.Ffinish += Finish;
                    finish.Ffinish += _displayFinishGame.FinishGame;
                }
            }
        }