private void SpawnAttackMinion(TowerController towerController) { MinionController minionController = ObjectPool.Instance.Get <MinionController>(_prefab, _attackSpawnTransform.position); minionController.LoyaltyState = _loyaltyState; minionController.SetAim(towerController); }
public void OnPointerDown(PointerEventData eventData) { if (Physics.Raycast(_camera.ScreenPointToRay(Input.mousePosition), out RaycastHit hit)) { if (hit.transform.TryGetComponent(out TowerController towerController)) { _selectedTowerController = towerController; } } }
private IEnumerator AttackCoroutine(TowerController towerController) { var waiter = new WaitForSeconds(_attackSpawnDelay); for (int i = 0; i < _preparedMinionCount / 2; i++) { _preparedMinionCount--; _minionCountText.text = _preparedMinionCount.ToString(); SpawnAttackMinion(towerController); yield return(waiter); } }
public void Attack(TowerController towerController) { StartCoroutine(AttackCoroutine(towerController)); }