public void RefreshUnitState() { if (!SelfBaseUnit.IsLive) { return; } UnitsEnemy.Clear(); UnitsAlly.Clear(); UnitsSelf.Clear(); foreach (var item in Units) { if (SelfBaseUnit.IsEnemy(item)) { UnitsEnemy.Add(item); } if (SelfBaseUnit.IsSOF(item)) { UnitsAlly.Add(item); } if (SelfBaseUnit.IsSelf(item)) { UnitsSelf.Add(item); } } }
public void RefreshEnemyAlly() { UnitsEnemy.Clear(); UnitsAlly.Clear(); UnitsSelf.Clear(); foreach (var item in Units) { if (SelfBaseUnit.IsEnemy(item)) { UnitsEnemy.Add(item); } if (SelfBaseUnit.IsSOF(item)) { UnitsAlly.Add(item); } if (SelfBaseUnit.IsSelf(item)) { UnitsSelf.Add(item); } } }
public void DoTestEnter(Collider col) { if (!SelfBaseUnit.IsLive) { return; } if (col == null) { return; } TUnit unit = col.GetComponent <TUnit>(); if (unit != null) { if (!unit.IsLive) { return; } Units.Add(unit); if (SelfBaseUnit.IsEnemy(unit)) { UnitsEnemy.Add(unit); } if (SelfBaseUnit.IsSOF(unit)) { UnitsAlly.Add(unit); } if (SelfBaseUnit.IsSelf(unit)) { UnitsSelf.Add(unit); } unit.DetectionMgr.Add(this, SelfBaseUnit); OnEnter(unit); } OnEnterObject(col); }