public override void Entered(Triggered o, Trigger t) { Unit other = o.GetComponent <Unit>(); if (other != null) { if (t.GetType() == typeof(NearUnit)) { if (other.Team != this.Team) { if (!NearUnits.Contains(other)) { NearUnits.Add(other); } } } if (t.GetType() == typeof(RangeUnit)) { if (other.Team != this.Team) { if (!RangeUnits.Contains(other)) { RangeUnits.Add(other); } } } } }
public override void Left(Triggered o, Trigger t) { Unit other = o.GetComponent <Unit>(); if (other != null) { if (t.GetType() == typeof(NearUnit)) { if (NearUnits.Contains(other)) { NearUnits.Remove(other); } } if (t.GetType() == typeof(RangeUnit)) { if (RangeUnits.Contains(other)) { RangeUnits.Remove(other); } } } }