/// <summary> /// Spawns the ally. /// </summary> /// <param name="_type">The type of ally to spawn.</param> public void SpawnAlly(int _type) { GameObject ally = Instantiate(allies [_type], AllySpawn.position, Quaternion.identity) as GameObject; ally.transform.localScale = new Vector3(1, 1, 1); ally.transform.SetParent(Canvas); AllyScript AS = ally.GetComponent <AllyScript> (); AS.TM = this; }
void OnTriggerEnter(Collider hit) { if (hit.tag == "Ally") { _isAttacking = true; _isAttackingAlly = true; _ally = hit.GetComponent <AllyScript> (); } if (hit.tag == "Tower") { _tower.TakeDamage(_attackDmg); ES.DestroyEnemy(); Destroy(this.gameObject); } // if (hit.tag == "Enemy") { // _canMove = false; // } }