List<AgentCutaway> IAgentFunctions.agentsInRange(ref AgentEnv client) { //Returns list of Agents Cutaways of observable agents Coordinates obs = client.getCoord(); List<AgentCutaway> rez = new List<AgentCutaway>(); foreach (AgentEnv ag in agentListm) { if (ag.getTypeName() == AgentType.Finder && client.getTypeName() == AgentType.Finder && canCommunicate(client, ag)) { rez.Add(ag.getCutaway()); } else if ((ag.getCoord() - obs).norm() < client.getViewRadius() && canSee(obs, ag.getCoord()) && ag.getID() != client.getID()) { rez.Add(ag.getCutaway()); } } return rez; }
bool IAgentFunctions.sendCellMatrix(int recieverID, ref AgentEnv sender) { // Send own search matrix to another agent AgentEnv reciever = findAgent(recieverID); if (canCommunicate(sender, reciever) && sender.getTypeName() == AgentType.Finder && reciever.getTypeName() == AgentType.Finder) { SearchCells temp; sender.getCellMatrix(out temp); reciever.uniteMatrix(temp); return true; } return false; }