public List<GameObject> getNearbyFilteredObjects(float radius, AgentClassification classification) { List<GameObject> objects = new List<GameObject>(); foreach(SensableObject obj in groupMembers.GetObjectsInRadius(this.getLegs ().myTrans.position, radius)) { if(obj.obj == getLegs().gameObject) { continue; } if(obj.classification == classification) { objects.Add(obj.obj); } } return objects; }
//check if there are wolf, sheep or sheperd, unknown object in SensedObject array public bool isContainAgent(AgentClassification type) { foreach (SensedObject obj in GetSensedObjects()) { if (obj.getAgentType().Equals(type)) { return true; } } return false; }
public SensedObject(GameObject obj, AgentClassification newType) { sensedObject = obj; type = newType; }
public SensedObject(GameObject obj) { sensedObject = obj; type = AgentClassification.Unknown; }