public Agent isAgentInView(Agent me) { foreach (Agent agent in agents) { if (agent.getId() != me.getId()) { double distance = agent.getNode(Agent.NodeType.Current).getDistance(me.getNode(Agent.NodeType.Current), simulation.getFieldOfViewMethod()); if (distance <= simulation.get(View.ViewNumericUpDown.FieldOfView)) { return agent; } } } return null; }
private void PaintAgentMap(Agent agent) { Debug.WriteLine("Painting " + agent.getId().ToString() + " Map"); for (int i = 0; i < agent.getMap().getNodes().Count; i++) { Node agentMapNode = agent.getMap().getNode(i); Node sharedMapNode = model.getMap().getNode(i); sharedMapNode.setFlag(Node.Flag.IsPath, agentMapNode.getFlag(Node.Flag.IsPath)); sharedMapNode.setFlag(Node.Flag.IsSpecial, agentMapNode.getFlag(Node.Flag.IsSpecial)); sharedMapNode.setFlag(Node.Flag.IsVisible, agentMapNode.getFlag(Node.Flag.IsVisible)); sharedMapNode.setFlag(Node.Flag.IsWalkable, agentMapNode.getFlag(Node.Flag.IsWalkable)); sharedMapNode.setCost(Node.Cost.Movement, agentMapNode.getCost(Node.Cost.Movement)); sharedMapNode.setCost(Node.Cost.Heuristic, agentMapNode.getCost(Node.Cost.Heuristic)); sharedMapNode.setCost(Node.Cost.Total, agentMapNode.getCost(Node.Cost.Total)); } model.Reset(true); }