示例#1
0
    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);
                    }
                }
            }
        }
    }
示例#2
0
    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);
                }
            }
        }
    }