public override void Update(Player pPlayer, Player pOtherPlayer) { switch (pPlayer.mCurrentState) { case 0: //-----Zu Positionen holden----- if (!Conditions.ActionHold(pPlayer)) { Sequences.SetPlayerToIdle(pPlayer); break; } if (Conditions.PlayersAtActionPositions(pPlayer, pOtherPlayer)) { ++pPlayer.mCurrentState; } Sequences.MovePlayerToRightActionPosition(pPlayer); break; case 1: //-----Animation starten----- Sequences.StartAnimation(pPlayer, Hardcoded.Anim_Amulet_Charge); Sequences.StartAnimation(pOtherPlayer, Hardcoded.Anim_Amulet_Charge); ++pPlayer.mCurrentState; pOtherPlayer.mCurrentState = pPlayer.mCurrentState; break; case 2: //-----Amulett hoch halten----- if (pPlayer.GetType() == typeof(Hansel)) { Sequences.UpdateActIProgressBoth(Progress, ActI, pPlayer, pOtherPlayer, new Vector2(0, -1)); //Sequences.UpdateAnimationStepping(rIObj, Progress.Progress); Sequences.UpdateAnimationStepping(pPlayer, Progress.Progress); } else { Sequences.UpdateAnimationStepping(pPlayer, Progress.Progress); } if (Progress.Complete) { Sequences.SetPlayerToIdle(pPlayer); Sequences.SetPlayerToIdle(pOtherPlayer); ActI.SetFadingState(pPlayer, false); ActI.SetFadingState(pOtherPlayer, false); rIObj.ActionRectList.Clear(); m2ndState = true; } break; } ActI.Update(); }
public override void Update(Player pPlayer, Player pOtherPlayer) { switch (pPlayer.mCurrentState) { case 0: //-----Zu Positionen holden----- if (!Conditions.ActionHold(pPlayer)) { Sequences.SetPlayerToIdle(pPlayer); break; } if (Conditions.PlayersAtActionPositions(pPlayer, pOtherPlayer)) { ++pPlayer.mCurrentState; } Sequences.MovePlayerToRightActionPosition(pPlayer); break; case 1: //-----Richtung bestimmen----- if (m2ndState) { ++pPlayer.mCurrentState; break; } m2ndState = true; if (pPlayer.GetType() == typeof(Hansel)) { mSourceHansel = pPlayer.SkeletonPosition; mSourceGretel = pOtherPlayer.SkeletonPosition; } else { mSourceHansel = pOtherPlayer.SkeletonPosition; mSourceGretel = pPlayer.SkeletonPosition; } mSourceIObj = rIObj.SkeletonPosition; //new Vector2(rIObj.CollisionRectList[0].X, rIObj.CollisionRectList[0].Y); Vector2 ActionToCollisionRectDirection = new Vector2(rIObj.CollisionRectList[0].X - rIObj.ActionRectList[0].X, rIObj.CollisionRectList[0].Y - rIObj.ActionRectList[0].Y); Vector2 DestinationDelta; if (ActionToCollisionRectDirection.Y > 0) { DestinationDelta = new Vector2(0, Hardcoded.PushRock_RockMoveDistance); ActI.SetThumbstickDirBoth(ActivityInstruction.ThumbstickDirection.Down); } else if (ActionToCollisionRectDirection.Y < 0) { DestinationDelta = new Vector2(0, -Hardcoded.PushRock_RockMoveDistance); ActI.SetThumbstickDirBoth(ActivityInstruction.ThumbstickDirection.Up); } else if (ActionToCollisionRectDirection.X > 0) { DestinationDelta = new Vector2(Hardcoded.PushRock_RockMoveDistance, 0); ActI.SetThumbstickDirBoth(ActivityInstruction.ThumbstickDirection.Right); } else { DestinationDelta = new Vector2(-Hardcoded.PushRock_RockMoveDistance, 0); ActI.SetThumbstickDirBoth(ActivityInstruction.ThumbstickDirection.Left); } mDestinationIObj = rIObj.SkeletonPosition + DestinationDelta; mDestinationHansel = mSourceHansel + DestinationDelta; mDestinationGretel = mSourceGretel + DestinationDelta; //Passende Animation entsprechend AnimationDirection starten Sequences.AnimateAccordingToDirection(pPlayer, ActionToCollisionRectDirection, Hardcoded.Anim_PushRock_Up, Hardcoded.Anim_PushRock_Down, Hardcoded.Anim_PushRock_Side); Sequences.AnimateAccordingToDirection(pOtherPlayer, ActionToCollisionRectDirection, Hardcoded.Anim_PushRock_Up, Hardcoded.Anim_PushRock_Down, Hardcoded.Anim_PushRock_Side); ++pPlayer.mCurrentState; pOtherPlayer.mCurrentState = pPlayer.mCurrentState; break; case 2: //-----Fels bewegen----- Sequences.UpdateActIProgressBoth(Progress, ActI, pPlayer, pOtherPlayer, mDestinationIObj - mSourceIObj, false); if (Progress.Progress >= 0f && !Conditions.ActionHold(pPlayer) && !Conditions.ActionHold(pOtherPlayer)) { //Abbrechbar Sequences.SetPlayerToIdle(pPlayer); Sequences.SetPlayerToIdle(pOtherPlayer); } if (pPlayer.GetType() == typeof(Hansel)) { Sequences.UpdateMovementStepping(rIObj, Progress.Progress, mSourceIObj, mDestinationIObj); Sequences.UpdateMovementStepping(pPlayer, Progress.Progress, mSourceHansel, mDestinationHansel); Sequences.UpdateMovementStepping(pOtherPlayer, Progress.Progress, mSourceGretel, mDestinationGretel); Sequences.UpdateAnimationStepping(pPlayer, Progress.Progress); Sequences.UpdateAnimationStepping(pOtherPlayer, Progress.Progress); } if (Progress.Complete) { Sequences.SetPlayerToIdle(pPlayer); Sequences.SetPlayerToIdle(pOtherPlayer); ActI.SetFadingState(pPlayer, false); ActI.SetFadingState(pOtherPlayer, false); rIObj.ActionRectList.Clear(); } break; } ActI.Update(); }
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(); }