Esempio n. 1
0
        public void Update(GameTime gameTime)
        {
            switch (selectionKind)
            {
            case SelectionKind.InputSelection:
                showTextElapsedTime += (int)gameTime.ElapsedGameTime.TotalMilliseconds;

                if (showTextElapsedTime > 249)
                {
                    if (showText)
                    {
                        showText = false;
                    }
                    else
                    {
                        showText = true;
                    }

                    showTextElapsedTime = 0;
                }
                break;

            case SelectionKind.CharacterSelection:
                //input.GetInputs();

                if (input.SelectX() != 0)
                {
                    ChangeCharacter(input.SelectX());
                }

                if (input.PauseGame())
                {
                    selectionBoxSourceRectangle.X = boxWidth;
                    selectionKind = SelectionKind.CharacterSelected;
                    Game1.numberOfPlayersSelected++;

                    characterSourceRectangle = new Rectangle((int)((currentCharacterFrame + maxCharacters) * characterSelectionWidth), 0, characterSelectionWidth, characterSelectionHeight);
                }

                break;

            case SelectionKind.CharacterSelected:
                //input.GetInputs();

                if (input.Back())
                {
                    selectionBoxSourceRectangle.X = 0;
                    selectionKind = SelectionKind.CharacterSelection;
                    Game1.numberOfPlayersSelected--;

                    characterSourceRectangle = new Rectangle((int)(currentCharacterFrame * characterSelectionWidth), 0, characterSelectionWidth, characterSelectionHeight);
                }

                break;
            }
        }