public void OnTriggerExit(Collider other) { string objName = other.gameObject.name; if (objName.Equals("Agent") || objName.Equals("Player")) { VertexReport report = new VertexReport(id, other.gameObject); SendMessageUpwards("RemoveLocation", report); } }
/// <summary> /// 子物体检测碰撞 添加相应vertex 记录着一个对象与哪个导航点发生了碰撞 /// (因为离开后就删除记录,所以同一时间应该只有一个记录) /// </summary> /// <param name="report"></param> public void AddLocation(VertexReport report) { int objId = report.obj.GetInstanceID(); if (!objToVertex.ContainsKey(objId)) { objToVertex.Add(objId, new List <int>()); } objToVertex[objId].Add(report.vertex); }
/// <summary> /// 子物体检测到碰撞结束 删除相应vertex /// </summary> /// <param name="report"></param> public void RemoveLocation(VertexReport report) { int objId = report.obj.GetInstanceID(); objToVertex[objId].Remove(report.vertex); }