public void RotateGun() // TODO: Subscribe on Update { if (_currentGun == null) { return; } BSU_Help.LookTargetY(ref _currentGun, _targetEnemy.transform); }
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); }
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); } } } }
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(); }