/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here gGameMode.Add("mainmenu", new MainMenuState()); gGameMode.Add("gamestate", new GameState()); gGameMode.Add("menu", new MenuState()); gGameMode.Add("itemmenu", new ItemMenuState()); base.Initialize(); }
// Use this for initialization void Start() { stateStack = GetComponent <StateStack>(); //Add all possible states here stateStack.Add("Game", new GameState()); stateStack.Add("Battle", new FightState()); //Push the first thingy on stateStack.Push("Battle"); }
/// <summary> /// Run logic for this state - including input /// </summary> /// <param name="GameTime">Snapshot of timing</param> public override void Update(GameTime GameTime) { // Get the current state, get the last state, and any new buttons are acted upon var currentState = Keyboard.GetState(); foreach (var i in currentState.GetPressedKeys()) { if (LastState.IsKeyUp(i)) { KeyPressed(i); } } LastState = currentState; // Do turn, if player next move is set if (G.Player.NextMove != Player.Instruction.NOT_SET) { G.DoTurn(); } if (G.GameOver) { StateStack.Add(new AtlasWarriors.LoseState(G)); } }
public void PushState() { StateStack.Add( new StreamState { Position = Position, Mode = Mode } ); }
protected void SetInstanceCore <TInstance>(TInstance instance, string extName) { var cell = StateStack.FirstOrDefault(p => p.InstanceType == typeof(TInstance) && p.ExtName == extName); if (cell != null) { cell.Instance = instance; } else { StateStack.Add(new InstanceCell { Instance = instance, ExtName = extName, InstanceType = typeof(TInstance) }); } }
/// <summary> /// Run logic for this state - including input /// </summary> /// <param name="GameTime">Snapshot of timing</param> public override void Update(GameTime GameTime) { // Get the current state, get the last state, and any new buttons are acted upon var currentState = Keyboard.GetState(); foreach (var i in currentState.GetPressedKeys()) { if (LastState.IsKeyUp(i)) { KeyPressed(i); } } LastState = currentState; // Get touch state var touchState = TouchPanel.GetState(); // Iterate through. Move the dude if in the 9 spaces. foreach (var touch in touchState) { if (touch.State == TouchLocationState.Pressed) { ProcessTouch(touch.Position); } } // Do turn, if player next move is set if (G.Player.NextMove != Player.Instruction.NOT_SET) { G.DoTurn(); } if (G.GameOver) { StateStack.Add(new LoseState(G)); } }
private void W_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { StateStack.Add(new GameState(g, GameApp)); StateStack.Remove(this); }
private void Dead() { StateStack.Remove(this); StateStack.Add(new DeadState(G)); }
private void BtnTitle_Pressed(object sender, System.EventArgs e) { StateStack.Remove(this); StateStack.Add(new TitleState()); }