public override void HandleInput(GameTime gameTime, InputState input) { PlayerIndex playerIndex; if (menuAccept.Evaluate(input, ControllingPlayer, out playerIndex)) { aiFlag = 1; game.SetAiFlag(aiFlag); OpponentAI ai = new OpponentAI(game); game.Components.Add(ai); ai.LoadCursor(game); game.Services.AddService(typeof(OpponentAI), ai); PlayerManager tempRef = (PlayerManager)game.Services.GetService(typeof(PlayerManager)); tempRef.LoadAI(game); ExitScreen(); } if (menuCancel.Evaluate(input, ControllingPlayer, out playerIndex)) { aiFlag = 0; game.SetAiFlag(aiFlag); ExitScreen(); } }
public void LoadAI(Game1 game) { ai = (OpponentAI)game.Services.GetService(typeof(OpponentAI)); }