private information[] gatherinfo() { List <information> r = new List <information>(); switch (type) { case normalunit: { //주변 유닛 찾기 Vector2 pos = new Vector2(transform.position.x, transform.position.y); Collider2D[] obj = Physics2D.OverlapCircleAll(pos, sightrange); foreach (Collider2D c in obj) { var o = c.gameObject; if (o.GetInstanceID() == gameObject.GetInstanceID()) //자신은 제외 { continue; } if (o.tag == "Unit") { //올바른 유닛인지에 대한 검사는 나중에 구현 information newinfo = new information("Unitinfo", o.name, null); r.Add(newinfo); newinfo.addmsg("gameobject", o); Debug.Log("Unit information has been added to unitpattern"); } } //공격을 받았거나 등의 피사건이 있는지 확인 //보통은 피격되거나 했을 시점에서 unitpattern 컴포넌트를 받아서 incident에 저장하는 식으로 하는게 좋을듯 foreach (information i in incident) { if (i == null) { continue; } switch (i.type) { } } } break; } return(r.ToArray()); }
public weapon getwp(weapon dest) => getwpbyindex(getwpindex(dest));//현제 게임오브젝트에 있어야 받아옴 public bool addincident(msg dest) { if (dest == null) { return(false); } information i = new information(dest.type, (string)dest.get("name", "string"), null); dest.remove("name"); i.addmsg(dest); incident.Add(i); return(true); }