Exemplo n.º 1
0
 // Constructor
 public PlayerAI(string name = "")
     : base(name)
 {
     state = AIState.Waiting;
     map = null;
     turnActions = new Queue<NotifyArgs>();
     waitingToSend = false;
     pushedState = false;
     departureTime = 0;
     friendlyPrograms = new List<Haxxit.Maps.ProgramHeadNode>();
     enemyPrograms = new List<Haxxit.Maps.ProgramHeadNode>();
     mapData = null;
     backgroundState = null;
 }
Exemplo n.º 2
0
 // This is the entry point to all AI routines.  It may be called multiple times
 // concurrently by the engine, so an AIState variable is used to direct execution
 // flow after each call and prevent duplicate calculations.
 public void HandleAITurn(Haxxit.Maps.Map currentMap, GameStates.MapPlayGameState newBackgroundState)
 {
     backgroundState = newBackgroundState;
     if(state == AIState.Planning)
     {
         return; // Let the AI finish planning the turn
     }
     else if (state == AIState.Sending)
     {
         SendActions();
     }
     else // state == AIState.waiting
     {
         state = AIState.Planning; // Planning to plan...
         map = currentMap;
         GetMapData(); // Load and restructure Map data for AI usage
         PlanTurn();   // Begin planning
         state = AIState.Sending;
     }
 }