示例#1
0
        private void HandleInput()
        {
            mButtons[mSelectedIndex].IsSelected = false;

            if (InputHelper.ButtonJustPressed2Player(Buttons.DPadRight))
            {
                ++mSelectedIndex;
            }
            else if (InputHelper.ButtonJustPressed2Player(Buttons.DPadLeft))
            {
                --mSelectedIndex;
            }

            if (mSelectedIndex == -1)
            {
                mSelectedIndex = 1;
            }
            if (mSelectedIndex == 2)
            {
                mSelectedIndex = 0;
            }

            mButtons[mSelectedIndex].IsSelected = true;

            if (InputHelper.ButtonJustPressed2Player(Buttons.A) || InputHelper.Player1.ActionJustPressed)
            {
                mButtons[mSelectedIndex].IsClicked();
            }
        }
示例#2
0
        public override void Update()
        {
            switch (State)
            {
            case FadingState.FadeIn:
                Visibility.StepForward();
                if (Visibility.Complete)
                {
                    State = FadingState.Idle;
                }
                break;

            case FadingState.Idle:
                if (InputHelper.ButtonJustPressed2Player(Buttons.B))
                {
                    State = FadingState.FadeOut;
                }
                break;

            case FadingState.FadeOut:
                Visibility.StepBackward();
                if (Visibility.Progress <= 0f)
                {
                    State = FadingState.FadeIn;
                    Visibility.Reset();
                    SceneManager.Instance.SetCurrentSceneTo("Menu");
                }
                break;
            }
        }
示例#3
0
 private void UpdateCredits()
 {
     if (InputHelper.ButtonJustPressed2Player(Buttons.B))
     {
         menuState = MenuState.Options;
     }
 }
示例#4
0
        private void UpdateMainMenu()
        {
            mButtons[SelectedIndex].IsSelected = false;

            if (InputHelper.ButtonJustPressed2Player(Buttons.DPadRight))
            {
                SelectedIndex++;
            }
            else if (InputHelper.ButtonJustPressed2Player(Buttons.DPadLeft))
            {
                SelectedIndex--;
            }

            if (SelectedIndex == -1)
            {
                SelectedIndex = 4;
            }
            if (SelectedIndex == 5)
            {
                SelectedIndex = 0;
            }

            mButtons[SelectedIndex].IsSelected = true;

            if (InputHelper.ButtonJustPressed2Player(Buttons.A) || InputHelper.Player1.ActionJustPressed)
            {
                mButtons[SelectedIndex].IsClicked();
            }
        }
示例#5
0
        private void UpdateOptionsMenu()
        {
            if (StartMoveing)
            {
                if (!MoveDirection)
                {
                    MoveListIn(new List <GameObject>(mOptionButtons));
                }
                else
                {
                    MoveListOut(new List <GameObject>(mOptionButtons));
                }
            }
            else
            {
                mOptionButtons[SelectedIndexOptions].IsSelected = false;

                if (InputHelper.ButtonJustPressed2Player(Buttons.DPadRight))
                {
                    SelectedIndexOptions++;
                }
                else if (InputHelper.ButtonJustPressed2Player(Buttons.DPadLeft))
                {
                    SelectedIndexOptions--;
                }

                if (SelectedIndexOptions == -1)
                {
                    SelectedIndexOptions = 2;
                }
                if (SelectedIndexOptions == 3)
                {
                    SelectedIndexOptions = 0;
                }

                mOptionButtons[SelectedIndexOptions].IsSelected = true;

                if (InputHelper.ButtonJustPressed2Player(Buttons.A))
                {
                    mOptionButtons[SelectedIndexOptions].IsClicked();
                }

                if (InputHelper.ButtonJustPressed2Player(Buttons.B))
                {
                    StartMoveing  = true;
                    MoveDirection = true;
                    mOptionButtons[SelectedIndexOptions].IsSelected = false;
                }
            }
        }
示例#6
0
        public override void Update()
        {
            if (End)
            {
                mState = GameState.End;
                End    = false;
            }
            mPauseMenu.Update(ref mState);
            switch (mState)
            {
            case GameState.Running:
                //Update Logic
                mLogic.Update(mSavegame, ref mScene, mHansel, mGretel, mCamera, mRenderer, ref mState);
                //Update Player
                mHansel.Update(mLogic.HanselMayMove, mHansel.mCurrentActivity.mMovementSpeedFactorHansel, mScene);
                mGretel.Update(mLogic.GretelMayMove, mGretel.mCurrentActivity.mMovementSpeedFactorGretel, mScene);
#if DEBUG
                //DebugCheats, im finalen Spiel löschen
                Cheats.Update(mSavegame, mScene, mHansel, mGretel);
#endif
                //Update Camera
                mCamera.MoveCamera(mHansel.CollisionBox, mGretel.CollisionBox);

                foreach (InteractiveObject io in mScene.InteractiveObjects)
                {
                    io.Update();
                }
                break;

            case GameState.CollectableInfo:
                if (InputHelper.ButtonJustPressed2Player(Buttons.A))
                {
                    mState = GameState.Running;
                }
                break;

            case GameState.End:
                mEndGameFading.StepForward();
                if (mEndGameFading.Complete && InputHelper.ButtonJustPressed2Player(Buttons.A))
                {                         //Wenn komplett sichtbar & ein Spieler drückt A
                    mEndGameFading.Reset();
                    RestartGame();
                    mState = GameState.Running;
                }
                break;
            }
        }
示例#7
0
        public void Update(ref GameScene.GameState pGameState)
        {
            if (InputHelper.ButtonJustPressed2Player(Buttons.Start))
            {
                mIsActive      = !mIsActive;
                mSelectedIndex = 0;
            }

            if (mIsActive)
            {
                HandleInput();
                pGameState = GameScene.GameState.Paused;
                return;
            }
            if (pGameState == GameScene.GameState.Paused)
            {
                pGameState = GameScene.GameState.Running;
            }
        }
示例#8
0
        private void UpdateCollectablesMenu()
        {
            if (StartMoveing)
            {
                if (!MoveDirection)
                {
                    MoveListIn(new List <GameObject>(mCollectableButton));
                }
                else
                {
                    MoveListOut(new List <GameObject>(mCollectableButton));
                }
            }
            else
            {
                mCollectableButton[SelectedIndexCollectable].IsSelected = false;

                if (InputHelper.ButtonJustPressed2Player(Buttons.DPadRight))
                {
                    SelectedIndexCollectable++;
                }
                else if (InputHelper.ButtonJustPressed2Player(Buttons.DPadLeft))
                {
                    SelectedIndexCollectable--;
                }
                else if (InputHelper.ButtonJustPressed2Player(Buttons.DPadUp) &&
                         SelectedIndexCollectable > 4)
                {
                    SelectedIndexCollectable -= 5;
                }
                else if (InputHelper.ButtonJustPressed2Player(Buttons.DPadDown) &&
                         SelectedIndexCollectable < 4)
                {
                    SelectedIndexCollectable += 5;
                }
                else if (InputHelper.ButtonJustPressed2Player(Buttons.DPadDown) &&
                         SelectedIndexCollectable == 4)
                {
                    SelectedIndexCollectable += 4;
                }

                if (SelectedIndexCollectable == -1)
                {
                    SelectedIndexCollectable = 8;
                }
                if (SelectedIndexCollectable == 9)
                {
                    SelectedIndexCollectable = 0;
                }

                mCollectableButton[SelectedIndexCollectable].IsSelected = true;

                if (InputHelper.ButtonJustPressed2Player(Buttons.A))
                {
                    mCollectableButton[SelectedIndexCollectable].IsClicked();
                }

                if (InputHelper.ButtonJustPressed2Player(Buttons.B))
                {
                    StartMoveing  = true;
                    MoveDirection = true;
                    mCollectableButton[SelectedIndexCollectable].IsSelected = false;
                }
            }
        }