Ejemplo n.º 1
0
        private void Quit()
        {
            Globals.multiplayerConnection = null;

            StateManager.ChangeState(Settings.STATES.ArmyEditor);
        }
Ejemplo n.º 2
0
        private void ReceivedArmy()
        {
            ((GameState)StateManager.GetState(1)).SetEnemyArmy(Armies.opponentArmy);

            StateManager.ChangeState(Settings.STATES.GameUI);
        }
Ejemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            if (selected != -1 && Armies.army[selected].IsDead)
            {
                selected = -1;
            }
            if (!IsTurn)
            {
                buttons[0].enabled = false;
            }
            else
            {
                buttons[0].enabled = true;
            }
            // UPDATE ANIMTION
            if (moveArrows != null)
            {
                for (int i = 0; i < moveArrows.Count; i++)
                {
                    moveArrows[i].Update(gameTime);
                }
            }
            if (attackIcons != null)
            {
                for (int i = 0; i < attackIcons.Count; i++)
                {
                    attackIcons[i].Update(gameTime);
                }
            }
            if (selected >= 0 && canAttackThis != null && canAttack[selected])
            {
                for (int i = 0; i < canAttackThis.Count; i++)
                {
                    Character c = Armies.opponentArmy[canAttackThis[i]];

                    c.UpdateSpriteSheetAnimation(gameTime);

                    if (c.sprite.CurrentFrame == 1)
                    {
                        c.sprite.CurrentFrame = 2;
                    }
                }
            }
            // END UPDATE ANIMATION

            // UNFINISHED WIN/LOSE DEFINITION/EFFECT
            if (Armies.army[0].IsDead || Armies.opponentArmy[0].IsDead)
            {
                StateManager.ChangeState(Settings.STATES.Result);
            }
            // END UNFINISHED WIN/LOSE DEFINITION/EFFECT

            // CONNECTION LOST
            if (Globals.multiplayerConnection.ConnectionLost)
            {
                StateManager.ChangeState(Settings.STATES.Result);
            }
            // END CONNECTION LOST

            if (IsTurn && !Globals.multiplayerConnection.IsWaitingForResponse)
            {
                CheckIfCanAttack();

                if (selected != -1)
                {
                    if (Globals.mouseState.LeftButtonPressed && Main.WindowRectangle.Contains(Globals.mouseState.Position))
                    {
                        bool contains = false;
                        contains = TestForMove(gameTime);
                        if (!contains)
                        {
                            contains = TestForAttack(gameTime);
                        }

                        if (!contains)
                        {
                            canMoveTo = null;
                        }
                        moveArrows  = null;
                        attackIcons = null;
                    }
                }

                if (Globals.mouseState.LeftButtonPressed && Main.WindowRectangle.Contains(Globals.mouseState.Position))
                {
                    SelectUnit(gameTime);
                }
            }

            if (StateManager.GetState(1) is GameState)
            {
                ((GameState)StateManager.GetState(1)).Update(gameTime);
            }
            Globals.multiplayerConnection.Update(gameTime);

            statsUI.UpdateAnimation(gameTime);

            if (selected > -1 && !canAttack[selected])
            {
                canAttackThis = null;
            }
        }
Ejemplo n.º 4
0
 private void Quit()
 {
     StateManager.RemoveState();
     StateManager.ChangeState(Settings.STATES.MainMenu);
 }
Ejemplo n.º 5
0
 private void StartGame()
 {
     StateManager.ChangeState(Settings.STATES.Game);
 }