Пример #1
0
        public void RotateGun() // TODO: Subscribe on Update
        {
            if (_currentGun == null)
            {
                return;
            }

            BSU_Help.LookTargetY(ref _currentGun, _targetEnemy.transform);
        }
Пример #2
0
        public void LevelUp(int level)
        {
            if (level >= _modelsTower.Count)
            {
                return;
            }

            _lvl         = level;
            _boltPos     = _spawnBolt[level].transform.position;
            _currentGun  = _modelGun[level];
            _targetSpawn = _spawnBolt[level];
            BSU_Help.ChangeLvl(_modelsTower, _lvl);
        }
Пример #3
0
        void FillModel(TypeTower tt)
        {
            BSU_Help.InstantiateList(out _modelsTower, tt.PrefabsTower, _parent);

            for (int i = 0; i < tt.PrefabsTower.Count; i++)
            {
                var find = _modelsTower[i].transform.GetComponentsInChildren <Transform>();
                foreach (var v in find)
                {
                    if (v.name == "gun")
                    {
                        _modelGun.Add(v.gameObject);
                    }

                    if (v.name == "spawnbolt")
                    {
                        _spawnBolt.Add(v.gameObject);
                    }
                }
            }
        }
Пример #4
0
        public void Update()
        {
            _dt += Time.deltaTime;


            if (Physics.CheckSphere(_parent.position, _affectedArea[_lvl], GameController.Instance.EnemyLayer))
            {
                var objs = Physics.OverlapSphere(_parent.position, _affectedArea[_lvl], GameController.Instance.EnemyLayer);

                if (objs.Length == 0)
                {
                    return;
                }

                _targetEnemy = BSU_Help.PrioritySearch(objs);
            }
            else
            {
                return;
            }

            Fire();
            RotateGun();
        }