Exemplo n.º 1
0
 //When agent moves off screen - moves them to opposite side
 public static void CheckOutOfBounds(MovingAgent agent)
 {
     if (agent.Position.X > ScreenWidth + agent.Size)
     {
         agent.ResetLines();
         //agent.Energy-=10;
         agent.PositionX = 0f;
         //agent.PositionX = ScreenWidth - agent.Size;
     }
     if (agent.Position.X < 0 - agent.Size)
     {
         agent.ResetLines();
         // agent.Energy-=10;
         agent.PositionX = ScreenWidth;
     }
     if (agent.Position.Y > ScreenHeight + agent.Size)
     {
         agent.ResetLines();
         // agent.Energy-=10;
         agent.PositionY = 0f;
     }
     if (agent.Position.Y < 0 - agent.Size)
     {
         agent.ResetLines();
         //agent.Energy-=10;
         agent.PositionY = ScreenHeight;
     }
 }