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