示例#1
0
 internal void AddAnchor(AgentSpaceAnchor <TAgent> anchor)
 {
     if (hasObstacle || (MultipleAnchorsAllowed == false && anchors.Count > 0))
     {
         throw new Exception();
     }
     else
     {
         anchors.Add(anchor);
     }
 }
示例#2
0
        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();
            }
        }
示例#3
0
 internal bool RemoveAnchor(AgentSpaceAnchor <TAgent> anchor)
 {
     return(anchors.Remove(anchor));
 }
示例#4
0
 public void MoveAgentAnchor(AgentSpaceAnchor <TAgent> anchor, int x, int y)
 {
     this[anchor.Field].RemoveAnchor(anchor);
     fields[x, y].AddAnchor(anchor);
 }
示例#5
0
 public void MoveAgentAnchor(AgentSpaceAnchor <TAgent> anchor, ISpaceField field)
 {
     this[anchor.Field].RemoveAnchor(anchor);
     fields[field.X, field.Y].AddAnchor(anchor);
     anchor.Field = field;
 }