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;
            }
        }
Beispiel #2
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;
            }
        }
Beispiel #3
0
        protected void UpdateLantern(Hansel pHansel, Gretel pGretel)
        {
            //Lantern
            if ((pHansel.SkeletonPosition - pGretel.SkeletonPosition).Length() <= Hardcoded.Lantern_MaxSwapDistance)
            {
                if (pHansel.Lantern && pHansel.mCurrentActivity == ActivityHandler.None && pHansel.Input.SwitchItemJustPressed)
                {
                    pGretel.Lantern = true;
                    pHansel.Lantern = false;
                }
                else if (pGretel.Lantern && pGretel.mCurrentActivity == ActivityHandler.None && pGretel.Input.SwitchItemJustPressed)
                {
                    pHansel.Lantern = true;
                    pGretel.Lantern = false;
                }
            }

            if (pHansel.Lantern)
            {
                LanternLight.Position = pHansel.SkeletonPosition;
                if (pHansel.Input.UseItemIsPressed)
                {
                    LanternRaiseProgress.StepForward();
                }
                else
                {
                    LanternRaiseProgress.StepBackward();
                }
            }
            else if (pGretel.Lantern)
            {
                LanternLight.Position = pGretel.SkeletonPosition;
                LanternRaiseProgress.Reset();
            }
            LanternLight.Depth  = Hardcoded.Lantern_Height + ((Hardcoded.Lantern_HeightRaised - Hardcoded.Lantern_Height) * LanternRaiseProgress.Progress);
            LanternLight.Radius = Hardcoded.Lantern_Radius + ((Hardcoded.Lantern_RadiusRaised - Hardcoded.Lantern_Radius) * LanternRaiseProgress.Progress);
        }
        public override void Update()
        {
            switch (State)
            {
            case LogoState.GA_FadeIn:
                Visibility.StepForward();
                if (Visibility.Complete)
                {
                    State = LogoState.GA_Idle;
                }
                break;

            case LogoState.GA_Idle:
                IdleTimer.StepForward();
                IdleTimer.StepForward();
                if (IdleTimer.Complete)
                {
                    IdleTimer.Reset();
                    State = LogoState.GA_FadeOut;
                }
                break;

            case LogoState.GA_FadeOut:
                Visibility.StepBackward();
                if (Visibility.Progress <= 0f)
                {
                    State = LogoState.Fables_FadeIn;
                }
                break;

            case LogoState.Fables_FadeIn:
                Visibility.StepForward();
                if (Visibility.Complete)
                {
                    State = LogoState.Fables_Idle;
                }
                break;

            case LogoState.Fables_Idle:
                IdleTimer.StepForward();
                if (IdleTimer.Complete)
                {
                    IdleTimer.Reset();
                    State = LogoState.Fables_FadeOut;
                }
                break;

            case LogoState.Fables_FadeOut:
                Visibility.StepBackward();
                if (Visibility.Progress <= 0f)
                {
                    SceneManager.Instance.SetCurrentSceneTo("Menu");
                }
                break;
            }
            if (InputHelper.Player1.InputJustPressed(InputHelper.mDebug))
            {
                Visibility.Reset();
                IdleTimer.Reset(true);
                SceneManager.Instance.SetCurrentSceneTo("Menu");
            }
        }
Beispiel #5
0
        public override void Update(Player pPlayer, Player pOtherPlayer)
        {
            switch (pPlayer.mCurrentState)
            {
            case 0:
                //-----Zu Positionen holden-----
                if (!Conditions.ActionHold(pPlayer))
                {
                    Sequences.SetPlayerToIdle(pPlayer);
                    break;
                }
                //Wenn Spieler an passenden Positionen sind
                if ((!m2ndState && Conditions.PlayersAtWellPositions(pPlayer, pOtherPlayer, false)) ||
                    (m2ndState && Conditions.PlayersAtWellPositions(pPlayer, pOtherPlayer, true))
                    )
                {
                    ++pPlayer.mCurrentState;
                }
                //Spieler zu passenden Positionen bewegen
                if (m2ndState)                         //Gretel im Brunnen zum Korb bewegen
                {
                    Sequences.MovePlayerToWellActionPosition(pPlayer, true);
                }
                else
                {
                    Sequences.MovePlayerToWellActionPosition(pPlayer, false);
                }
                break;

            case 1:
                //Nur gemeinsam starten
                if (pOtherPlayer.mCurrentState > 0)
                {
                    ++pPlayer.mCurrentState;
                }
                break;

            case 2:
                //-----Animationen starten (Hansel an Kurbel bereit machen, Gretel in Korb steigen)-----
                m2ndState = true;
                if (pPlayer.GetType() == typeof(Hansel))
                {
                    pPlayer.SetAnimation(Hardcoded.Anim_Well_GrabWind_Hansel);                             //An Kurbel
                }
                else
                {
                    pPlayer.SetAnimation(Hardcoded.Anim_Well_Enter_Gretel, false);                             //In Korb steigen
                }
                ++pPlayer.mCurrentState;
                break;

            case 3:
                //-----Gretel bereit / im Korb?-----
                if (pOtherPlayer.mCurrentState < 3)
                {
                    break;
                }
                bool finished = false;
                if (pPlayer.GetType() == typeof(Gretel))                         //Gretel im Korb
                {
                    finished = Conditions.AnimationComplete(pPlayer);
                }
                else
                {
                    finished = Conditions.AnimationComplete(pOtherPlayer);
                }
                if (finished)
                {
                    ++pPlayer.mCurrentState;
                }
                break;

            case 4:
                //-----Brunnen hochziehen / herablassen-----
                if (pOtherPlayer.mCurrentState != 4)
                {
                    break;
                }
                if (pPlayer.GetType() == typeof(Hansel))
                {
                    if (pPlayer.Input.ActionIsPressed && pPlayer.Input.LeftStickRotation != 0f && pOtherPlayer.Input.ActionIsPressed)                             //Brunnen wird bewegt?
                    {
                        if (pPlayer.Input.LeftStickRotation > 0f)
                        {
                            pPlayer.SetAnimation(Hardcoded.Anim_Well_Wind_Down_Hansel);                                     //Brunnen runter lassen Animation
                            pOtherPlayer.SetAnimation(Hardcoded.Anim_Well_Hang_Gretel);
                        }
                        else if (pPlayer.Input.LeftStickRotation < 0f)
                        {
                            pPlayer.SetAnimation(Hardcoded.Anim_Well_Wind_Up_Hansel);                                     //Brunnen hoch ziehen Animation
                            pOtherPlayer.SetAnimation(Hardcoded.Anim_Well_Hang_Gretel);
                        }
                        ActI.SetFadingState(pPlayer, false, false);
                        ActI.SetFadingState(pOtherPlayer, false, false);
                        Progress.StepFromRotation(pPlayer.Input.LeftStickRotation, Hardcoded.UseWell_ProgressPerRotation, Hardcoded.UseWell_UpRotationFrictionFactor);
                    }
                    else
                    {
                        pPlayer.SetAnimation(Hardcoded.Anim_Well_Wind_Idle_Hansel);                                 //Brunnen idle Animation
                        pOtherPlayer.SetAnimation(Hardcoded.Anim_Well_Idle_Gretel);
                        if (pPlayer.Input.ActionIsPressed && pPlayer.Input.LeftStickRotation != 0f)                 //Hansel versucht Brunnen zu bewegen?
                        {
                            ActI.SetFadingState(pPlayer, false, false);
                        }
                        else
                        {
                            ActI.SetFadingState(pPlayer, true, false);
                        }
                        if (pOtherPlayer.Input.ActionIsPressed)
                        {
                            ActI.SetFadingState(pOtherPlayer, false, false);
                        }
                        else
                        {
                            ActI.SetFadingState(pOtherPlayer, true);
                        }
                    }

                    if (Progress.Progress <= 0f && pPlayer.Input.LeftStickRotation < 0f)
                    {
                        ActI.SetFadingState(pPlayer, false);
                        ActI.SetFadingState(pOtherPlayer, false);
                        Progress.Reset();
                        pPlayer.SetAnimation();                                 //Hansel von Kurbel weg nehmen
                        pPlayer.mCurrentState      = 10;
                        pOtherPlayer.mCurrentState = 8;
                    }
                    if (Progress.Progress >= 1f && pPlayer.Input.LeftStickRotation > 0f)
                    {
                        ActI.SetFadingState(pPlayer, false);
                        ActI.SetFadingState(pOtherPlayer, false);
                        Progress.Reset(true);
                        pOtherPlayer.mCurrentState = 8;
                    }
                    Sequences.UpdateAnimationStepping(rIObj, Progress.Progress);
                    Sequences.UpdateMovementStepping(pOtherPlayer, Progress.Progress, Conditions.WellActionPosition2Up(rIObj), rIObj.ActionPosition2);
                }
                break;

            case 8:
                //-----Oben/Unten aussteigen-----
                pPlayer.SetAnimation(Hardcoded.Anim_Well_Leave_Gretel, false);                         // Aus Eimer aussteigen
                ++pPlayer.mCurrentState;
                break;

            case 9:
                if (Conditions.AnimationComplete(pPlayer))
                {
                    pPlayer.SetAnimation();
                    ++pPlayer.mCurrentState;
                }
                break;

            case 10:
                //-----States setzen-----
                if (Conditions.AnimationComplete(pPlayer))
                {
                    Sequences.SetPlayerToIdle(pPlayer);
                    if (pPlayer.GetType() == typeof(Hansel))
                    {
                        Progress.Reset();
                        m2ndState = false;
                    }
                }
                break;
            }
            ActI.Update();
        }
Beispiel #6
0
        public override void Update(Player pPlayer, Player pOtherPlayer)
        {
            switch (pPlayer.mCurrentState)
            {
            case 0:
                //-----Zu Position holden-----
                if (!m2ndState)                         //LegUp
                {
                    Progress.Reset();                   //LegUp kann mehrfach ausgeführt werden
                }
                if (!Conditions.ActionHold(pPlayer))
                {
                    Sequences.SetPlayerToIdle(pPlayer);
                    break;
                }
                if (Conditions.PlayersAtActionPositions(pPlayer, pOtherPlayer, Hardcoded.LegUp_StartOffsetGretel))
                {
                    ++pPlayer.mCurrentState;
                }
                Sequences.MovePlayerToRightActionPosition(pPlayer, Hardcoded.LegUp_StartOffsetGretel);
                break;

            case 1:
                Sequences.StartAnimation(pPlayer, Hardcoded.Anim_LegUp_Raise);
                ActI.ThumbstickDirHansel = ActivityInstruction.ThumbstickDirection.Up;
                ActI.ThumbstickDirGretel = ActivityInstruction.ThumbstickDirection.None;
                ++pPlayer.mCurrentState;
                break;

            case 2:
                //-----Hoch heben-----
                if (pPlayer.GetType() == typeof(Hansel))
                {
                    Sequences.UpdateActIProgressBothLegUp(Progress, ActI, pPlayer, pOtherPlayer, new Vector2(0, -1));
                    if (Progress.Progress <= 0f && !Conditions.ActionHold(pPlayer) && !Conditions.ActionHold(pOtherPlayer))
                    {                             //Abbrechbar
                        Sequences.SetPlayerToIdle(pPlayer);
                        Sequences.SetPlayerToIdle(pOtherPlayer);
                    }
                    Sequences.UpdateAnimationStepping(pPlayer, Progress.Progress);
                    Sequences.UpdateAnimationStepping(pOtherPlayer, Progress.Progress);

                    if (Progress.Complete)
                    {                             //GretelGrab am höchsten Punkt
                        ActI.ThumbstickDirGretel = ActivityInstruction.ThumbstickDirection.Up;
                        if (Conditions.ActionThumbstickPressed(pOtherPlayer, new Vector2(0, -1)))
                        {                                 //Start Grab
                            ActI.SetFadingState(pPlayer, false);
                            ActI.SetFadingState(pOtherPlayer, false, false);
                            ++pPlayer.mCurrentState;
                            pOtherPlayer.mCurrentState = pPlayer.mCurrentState;
                        }
                        else                                 //Show ActI f Gretel
                        {
                            ActI.SetFadingState(pOtherPlayer, true);
                        }
                    }
                    else
                    {                             //Nicht am höchsten Punkt: ActI.Gretel nicht Thumbstick anzeigen
                        ActI.ThumbstickDirGretel = ActivityInstruction.ThumbstickDirection.None;
                    }
                }
                break;

            case 3:
                //-----Gretel nächste Animation starten-----
                if (pPlayer.GetType() == typeof(Gretel))
                {
                    if (!m2ndState)                                                          //LegUp
                    {
                        Sequences.StartAnimation(pPlayer, Hardcoded.Anim_LegUp_Lift_Gretel); //hoch ziehen
                    }
                    else                                                                     //LegUpGrab
                    {
                        Sequences.StartAnimation(pPlayer, Hardcoded.Anim_LegUp_Grab_Gretel); //Item greifen
                        rIObj.ActionRectList.Clear();                                        //LegUpGrab kann nicht mehrfach ausgeführt werden
                    }
                    ++pPlayer.mCurrentState;
                    pOtherPlayer.mCurrentState = pPlayer.mCurrentState;
                }
                break;

            case 4:
                //-----Gretel fertig?-----
                if (pPlayer.GetType() == typeof(Hansel) && Conditions.AnimationComplete(pOtherPlayer))
                {
                    ActI.SetFadingState(pOtherPlayer, false);
                    if (m2ndState)                             //LegUpGrab
                    {
                        //Gretel runter lassen
                        Sequences.StartAnimation(pPlayer, Hardcoded.Anim_LegUp_Lower);
                        Sequences.StartAnimation(pOtherPlayer, Hardcoded.Anim_LegUp_Lower);
                    }
                    ++pPlayer.mCurrentState;
                    pOtherPlayer.mCurrentState = pPlayer.mCurrentState;
                }
                break;

            case 5:
                //-----Beide fertig?-----
                if (Conditions.AnimationComplete(pPlayer))
                {
                    if (!m2ndState && pPlayer.GetType() == typeof(Gretel))
                    {
                        Sequences.Move(pPlayer, Hardcoded.LegUp_OffsetGretel[GameReferenzes.SceneID]);                                 //Bei LegUp Gretel hoch setzen
                    }
                    Sequences.SetPlayerToIdle(pPlayer);
                }
                break;
            }
            ActI.Update();
        }