internal void AddAnchor(AgentSpaceAnchor <TAgent> anchor) { if (hasObstacle || (MultipleAnchorsAllowed == false && anchors.Count > 0)) { throw new Exception(); } else { anchors.Add(anchor); } }
public AgentSpaceAnchor <TAgent> CreateAgentAnchor(TAgent agent, int x, int y) { var field = fields[x, y]; if (field.IsEmpty) { var anchor = new AgentSpaceAnchor <TAgent>(agent, field); fields[x, y].AddAnchor(anchor); return(anchor); } else { throw new Exception(); } }
internal bool RemoveAnchor(AgentSpaceAnchor <TAgent> anchor) { return(anchors.Remove(anchor)); }
public void MoveAgentAnchor(AgentSpaceAnchor <TAgent> anchor, int x, int y) { this[anchor.Field].RemoveAnchor(anchor); fields[x, y].AddAnchor(anchor); }
public void MoveAgentAnchor(AgentSpaceAnchor <TAgent> anchor, ISpaceField field) { this[anchor.Field].RemoveAnchor(anchor); fields[field.X, field.Y].AddAnchor(anchor); anchor.Field = field; }