Пример #1
0
        public override void Kill()
        {
            base.Kill();
            alivePlayersUnitsSO.Value = alivePlayersUnitsSO.Value - 1;
            GameAbstractFactory gameAbtractFactory = GameFactoryProducer.GetFactory("PlayerUnitsFactory");

            gameAbtractFactory.RecyclePlayerUnit(this);
        }
Пример #2
0
        IEnumerator InitializeUnitsCR()
        {
            for (int i = 0; i < _maxUnits; i++)
            {
                GameAbstractFactory gameAbtractFactory = GameFactoryProducer.GetFactory("PlayerUnitsFactory");
                PlayerUnit          newUnit            = gameAbtractFactory.GetPlayerUnit();
                newUnit.alive = true;
                newUnit.gameObject.transform.position    = spawnPoints[i].position;
                newUnit.gameObject.transform.eulerAngles = new Vector3(0, 45, 0);
                newUnit.gameObject.SetActive(true);
                _playerUnits[i] = newUnit;

                levelGrid.CloseCellAthisPosition(spawnPoints[i].position); // setting the cells as blocked
            }
            yield return(null);

            _currentUnit = _playerUnits[0];
            alivePlayersUnitsSO.Value = _maxUnits;
        }
Пример #3
0
        IEnumerator InitializeUnitsCR()
        {
            for (int i = 0; i < _maxUnits; i++)
            {
                GameAbstractFactory gameAbtractFactory = GameFactoryProducer.GetFactory("AIUnitsFactory");
                AIUnit newUnit = gameAbtractFactory.GetAIUnit();
                newUnit.alive = true;
                newUnit.gameObject.transform.position    = spawnPoints[i].position;
                newUnit.gameObject.transform.eulerAngles = new Vector3(0, 225, 0);
                newUnit.gameObject.SetActive(true);
                newUnit.onUnitLostLifeEvent += OnUnitLostLifeEvent;
                newUnit.levelGrid            = levelGrid;
                _aiUnits[i] = newUnit;
                levelGrid.CloseCellAthisPosition(spawnPoints[i].position); // setting the cells as blocked

                yield return(new WaitForSeconds(.1f));
            }
            _currentAIUnit       = _aiUnits[0];
            aliveAIUnitsSO.Value = _maxUnits;
        }