/// <summary> /// Removes a ShielUnit from the reference List. /// </summary> /// <param name="_shieldUnit">The ShieldUnit to be removed.</param> public void RemoveShield(ShieldUnit _shieldUnit) { shields.Remove(_shieldUnit); audioSource.Play(); if (shields.Count <= 0) { GameManager.instance.GameOver(false); } }
private void OnTriggerEnter(Collider other) { UnitCombat combat = other.GetComponent <UnitCombat>(); if (combat != null && combat.TeamIndex != unit.TeamIndex) { if (!unit.isAttacking) { ArtilleryUnit au = unit as ArtilleryUnit; ShieldUnit su = combat.gameObject.GetComponent <ShieldUnit>(); if (au != null && su != null) { return; } unit.PreemptOrder(new AttackOrder(other.transform)); } } }