public AI(Fighter _ship) { ship = _ship; createPersonality(); random = new Random(System.DateTime.Now.Millisecond + (int)Ship.UniqueId); aiShared = new AI_Shared_Data(); aiShared.INTEREST_TIME = Ship.InterestTime + (float)random.NextDouble(); mySpawningState = new AISpawningState(this); myWaitingToSpawnState = new AIWaitingToSpawnState(this); myWanderState = new AIWanderState(this); myPursuitState = new AIPursuitState(this); myEngageBattleshipState = new AIEngageBattleshipState(this); myRetreatState = new AIRetreatState(this); myDyingState = new AIDyingState(this); potentialCapitals = new List<CapitalShip>(); potentialFighters = new List<Fighter>(); currentState = myWaitingToSpawnState; AI_Overmind.inWaitingToSpawn++; assignedPhase = nextAssignedPhase; switch (nextAssignedPhase) { case aiActivationPhase.first: nextAssignedPhase = aiActivationPhase.second; break; case aiActivationPhase.second: nextAssignedPhase = aiActivationPhase.third; break; case aiActivationPhase.third: nextAssignedPhase = aiActivationPhase.first; break; } }
public void Update(float deltaTime) { if (Space394Game.GameInstance.CurrentScene is GameScene) { // if (assignedPhase == currentPhase) { currentState.Update(deltaTime); LogCat.updateValue("In Dying", "" + AI_Overmind.inDying); LogCat.updateValue("In Engage Battleship", "" + AI_Overmind.inEngageBattleship); LogCat.updateValue("In Pursuit", "" + AI_Overmind.inPursuit); LogCat.updateValue("In Retreat", "" + AI_Overmind.inRetreat); LogCat.updateValue("In Spawning", "" + AI_Overmind.inSpawning); LogCat.updateValue("In Wander", "" + AI_Overmind.inWander); LogCat.updateValue("In Waiting To Spawn", "" + AI_Overmind.inWaitingToSpawn); if (currentState.StateComplete) { stateChanges++; currentState = currentState.getNextState(this); } else { } } } }
public AIState nextState() { currentState = currentState.getNextState(this); return currentState; }