Пример #1
0
 /// <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();
 }
Пример #2
0
    // 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");
    }
Пример #3
0
        /// <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));
            }
        }
Пример #4
0
 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)
                });
            }
        }
Пример #6
0
        /// <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));
            }
        }
Пример #7
0
 private void W_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     StateStack.Add(new GameState(g, GameApp));
     StateStack.Remove(this);
 }
Пример #8
0
 private void Dead()
 {
     StateStack.Remove(this);
     StateStack.Add(new DeadState(G));
 }
Пример #9
0
 private void BtnTitle_Pressed(object sender, System.EventArgs e)
 {
     StateStack.Remove(this);
     StateStack.Add(new TitleState());
 }