Exemple #1
0
 public GameOverChecker(GameObject ui, SliderController slider)
 {
     _slider          = slider;
     _overUI          = ui;
     slider.NewValue += AddValue;
     slider.Load     += ChangeToSerializedValue;
 }
Exemple #2
0
        private void Start()
        {
            if (GameObject.FindObjectsOfType <Transform>().Length <= 4)
            {
                SceneSaver.LoadScene();
            }
            else
            {
                _startPoint = GameObject.FindGameObjectWithTag("Respawn").transform;
                _uiGameOver = GameObject.FindGameObjectWithTag("Finish");
                _sliderUI   = GameObject.FindGameObjectWithTag("Slider").GetComponent <Slider>();
                var enemyesRespawns = GameObject.FindGameObjectsWithTag("EnemyRespawn");
                _pointsForEnemySpawn = new Transform[enemyesRespawns.Length];

                for (int i = 0; i < enemyesRespawns.Length; i++)
                {
                    _pointsForEnemySpawn[i] = enemyesRespawns[i].transform;
                }

                _interactiveObjects = GameObject.FindGameObjectWithTag("Bonuses").transform.GetComponentsInChildren <Transform>();

                var repository = new Repository(_serializer);
                ServiceLocator.SetDependency(repository);
                GameObject updaterGO = new GameObject("Updater");
                updaterGO.AddComponent <ControllersUpdater>();

                RadarController radar = new RadarController(FindObjectsOfType <Image>().FirstOrDefault(x => x.gameObject.CompareTag("Bonuses")).transform);
                ServiceLocator.SetDependency(radar);
                ControllersUpdater.AddUpdate(radar);

                _sliderUI.maxValue = _interactiveObjects.Length;
                var slider = new SliderController(_sliderUI);
                //ServiceLocator.SetDependency(slider);

                var gameOverChecker = new GameOverChecker(_uiGameOver, slider);
                new ButtonReloaderView(_uiGameOver.GetComponentInChildren <Button>());
                ServiceLocator.SetDependency(gameOverChecker);
                gameOverChecker.GameEnd(false, false);
                new PlayerInizializator(_playerData, _startPoint, UserName);

                //ServiceLocator.GetDependency<Repository>().AddDataToList(slider);
                repository.AddDataToList(slider);


                for (int i = 0; i < _interactiveObjects.Length; i++)
                {
                    var bonus = new PointBonus(_interactiveObjects[i].gameObject, i, slider);
                    repository.AddDataToList(bonus);
                    var sprite = Resources.Load <GameObject>("Textures/PickupRadar");
                    radar.AddingObject(_interactiveObjects[i].gameObject, sprite);
                }
                new EnemySpawner(_pointsForEnemySpawn, _enemyData);
                Destroy(gameObject);
            }

            #endregion
        }
Exemple #3
0
 public PointBonus(GameObject gameObject, int objectID, SliderController slider) : base(gameObject, objectID)
 {
     _sliderController = slider;
 }