public List <TrigerAgent> CollectTriger() { List <TrigerAgent> trigers = new List <TrigerAgent> (); int cnt = transform.childCount; for (int i = 0; i < cnt; ++i) { Transform t = transform.GetChild(i); TrigerAgent triger = t.gameObject.GetComponent <TrigerAgent>(); if (triger != null) { trigers.Add(triger); } } return(trigers); }
void OnEnable() { _triger = target as TrigerAgent; }