Exemple #1
0
 //Adds to a swarm
 public void AddToSwarm(AI a, int swarmValue)
 {
     loneAi.Remove(a);
     a.SwarmValue = swarmValue;
     swarms[swarmValue].AI.Add(a);
     swarms[swarmValue].Grid.AddPoint();
 }
Exemple #2
0
 //Creates a swarm
 public void CreateSwarm(AI a, AI b)
 {
     loneAi.Remove(a);
     loneAi.Remove(b);
     a.SwarmValue = SwarmCount;
     b.SwarmValue = SwarmCount;
     swarms.Add(new Swarm(a, b));
 }
Exemple #3
0
        //Constructer of the SwarmGrid Ai 'a' holds the center point for the grid
        public SwarmGrid(int Size, AI a, AI b)
        {
            size = Size;

            //Adds all the points
            points.Add(new Vector2(a.BoundingRect.X, a.BoundingRect.Y));
            AddPoint();
        }
Exemple #4
0
 //Removes an ai
 public void RemoveAI(AI a)
 {
     if (a.SwarmValue != -1)
     {
         swarms[a.SwarmValue].Grid.RemovePoint();
         swarms[a.SwarmValue].AI.Remove(a);
     }
     else
     {
         loneAi.Remove(a);
     }
 }
Exemple #5
0
 //Adds a lone ai
 public void AddLoneAI(AI a)
 {
     loneAi.Add(a);
 }
Exemple #6
0
            //Initializes the swarm
            public Swarm(AI a, AI b)
            {
                ai.Add(a);
                ai.Add(b);

                //Creates a very small velocity to 
                groupVelocity = a.Velocity;

                //Creates the swarm grid if needed
                switch (a.Type)
                {
                    case Type.Square:

                        grid = new SwarmGrid(a.BoundingRect.Width, a, b);
                        break;

                    case Type.Circle:

                        grid = new SwarmGrid(a.BoundingRect.Width, a, b);
                        break;

                    case Type.Triangle:

                        grid = new SwarmGrid(a.BoundingRect.Width, a, b);
                        break;
                }
            }