private void OnInstaller(SlingManager slingManager)
        {
            _slingManager = slingManager;

            LevelEventBus.SubscribeEvent(LevelEventType.STARTED, () => _deleteIndex = 0);
            LevelEventBus.SubscribeEvent(LevelEventType.LEVEL_UP, () => DeleteLevel(_deleteIndex++));
        }
        private void Awake()
        {
            _levelGenerator.Initialize();
            _playerView.Initialize();
            _carBase.Initialize();


            LevelEventBus.SubscribeEvent(LevelEventType.STARTED, (number) =>
            {
                Debug.Log("Gameplay Count : " + number);
            });
        }
        public CarSlingController(CarDirectionController carDirectionController, SlingManager slingManager,
                                  PlayerView playerView)
        {
            _slingManager           = slingManager;
            _carDirectionController = carDirectionController;
            _playerView             = playerView;

            LevelEventBus.SubscribeEvent(LevelEventType.STARTED, () =>
            {
                _targetSling      = null;
                _targetSlingIndex = 0;
            });
        }
        public void Initialize()
        {
            ButtonVisible(true);
            _levelUpText.enabled = false;
            _counterText.enabled = false;

            _startButton.onClick.AddListener(() => LevelEventBus.InvokeEvent(LevelEventType.STARTED));
            _startButton.onClick.AddListener(() => LevelEventBus.InvokeEvent(LevelEventType.STARTED, ++_gamePlayCount));

            LevelEventBus.SubscribeEvent(LevelEventType.STARTED, () =>
            {
                UpdateCounter(0);
                _counterText.enabled = true;
                ButtonVisible(false);
            });
            LevelEventBus.SubscribeEvent(LevelEventType.FAIL, () => ButtonVisible(true));
            LevelEventBus.SubscribeEvent(LevelEventType.LEVEL_UP, OnLevelUp);
        }
        public void Initialize()
        {
            LevelEventBus.SubscribeEvent(LevelEventType.FAIL, () =>
            {
                _finalHighway = null;
                _levelIndex   = 0;
                _levelManager.DeleteWholeLevels();
            });

            LevelEventBus.SubscribeEvent(LevelEventType.STARTED, () =>
            {
                GenerateLevels(3);
                _carBase.SetCarPosition(_levelManager.GetHighwayOfLevel(0, 0).transform);
            });
            LevelEventBus.SubscribeEvent(LevelEventType.LEVEL_UP, () =>
            {
                Timer.Instance.TimerWait(5f, () => GenerateLevels(1));
            });
        }
Beispiel #6
0
        public void Initialize(CarSlingController carSlingController)
        {
            IsActive = false;

            _carSlingController = carSlingController;

            _driftEffect = GetComponentInChildren <TrailRenderer>();

            LevelEventBus.SubscribeEvent(LevelEventType.STARTED, () =>
            {
                IsActive = true;
                _driftEffect.Clear();
            });
            LevelEventBus.SubscribeEvent(LevelEventType.FAIL, () =>
            {
                IsActive = false;
            });

            _carCornerDetector = new CarCornerDetector(transform);
            _movingActive      = true;
        }
Beispiel #7
0
        public void Initialize()
        {
            _carCamera    = _carCamera == null ? Camera.main : _carCamera;
            _cameraOffset = _carCamera.transform.position - transform.position;

            _carDirectionController = new CarDirectionController(transform);
            _carSlingController     = new CarSlingController(_carDirectionController, _slingManager, _playerView);

            _carMovementController = GetComponent <CarMovementController>();
            _carMovementController.Initialize(_carSlingController);

            LevelEventBus.SubscribeEvent(LevelEventType.STARTED, () =>
            {
                gameObject.SetActive(true);
            });
            LevelEventBus.SubscribeEvent(LevelEventType.FAIL, ()
                                         =>
            {
                gameObject.SetActive(false);
            });
        }
Beispiel #8
0
        public CarDirectionController(Transform carBase)
        {
            _carBase = carBase;

            LevelEventBus.SubscribeEvent(LevelEventType.FAIL, () => _handleAnim.Kill());
        }