//Richtige Animation und richtigen FlipState anwenden public static void AnimateAccordingToDirection(SpineObject pSpine, Vector2 pDirection, string pAnimUp, string pAnimDown, string pAnimSide) { string anim = Character.GetRightDirectionAnimation(pDirection, pAnimUp, pAnimDown, pAnimSide); Character.SetSkeletonFlipState(pSpine, pDirection); Sequences.StartAnimation(pSpine, anim); }
public override void Update(Player pPlayer, Player pOtherPlayer) { switch (pPlayer.mCurrentState) { case 0: //-----Animation starten----- Sequences.StartAnimation(pPlayer, Hardcoded.Anim_Amulet_Use); ++pPlayer.mCurrentState; break; case 1: //-----Amulett hoch halten----- Sequences.UpdateActIProgress(Progress, ActI, pPlayer, new Vector2(0, -1)); Sequences.UpdateAnimationStepping(pPlayer, Progress.Progress); //Abbrechbar if (Progress.Progress <= 0f && !Conditions.ActionHold(pPlayer) && !Conditions.ActionHold(pOtherPlayer)) { Sequences.SetPlayerToIdle(pPlayer); } if (Progress.Complete) { Sequences.SetPlayerToIdle(pPlayer); ActI.SetFadingState(pPlayer, false); //Delete Witch m2ndState = true; } break; } ActI.Update(); }
public override void Update(Player pPlayer, Player pOtherPlayer) { switch (pPlayer.mCurrentState) { case 0: //-----Zu Position bewegen----- if (Conditions.PlayerAtNearestActionPosition(pPlayer)) { ++pPlayer.mCurrentState; } Sequences.MovePlayerToNearestActionPosition(pPlayer); break; case 1: //-----Richtung bestimmen----- mDestination = rIObj.DistantActionPosition(pPlayer.SkeletonPosition); mSource = pPlayer.SkeletonPosition; Sequences.AnimateAccordingToDirection(pPlayer, mDestination - mSource, Hardcoded.Anim_Jump_Up_Hansel, Hardcoded.Anim_Jump_Down_Hansel, Hardcoded.Anim_Jump_Side_Hansel); ++pPlayer.mCurrentState; break; case 2: //-----Springen----- Sequences.SynchMovementToAnimation(pPlayer, pPlayer, mSource, mDestination); if (Conditions.AnimationComplete(pPlayer)) { Sequences.SetPlayerToIdle(pPlayer); } break; } }
public void UpdateOverlay(ref List <InteractiveObject> pRenderList) { if (Progress.Progress > Hardcoded.UseWell_ShowOverlayProgressBarrier) { Sequences.SetWellOverlay(rIObj.SkeletonPosition, false, ref pRenderList); //Hide Overlay return; } Sequences.SetWellOverlay(rIObj.SkeletonPosition, true, ref pRenderList); //Display Overlay }
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 Position bewegen----- if (Conditions.PlayerAtNearestActionPosition(pPlayer)) { ++pPlayer.mCurrentState; } Sequences.MovePlayerToNearestActionPosition(pPlayer); break; case 1: //-----Animation starten----- Sequences.StartAnimation(pPlayer, Hardcoded.Anim_SlipAway_Gretel); //Weg bewegen ++pPlayer.mCurrentState; break; case 2: //-----Weg bewegt?----- if (Conditions.AnimationComplete(pPlayer)) { Destination = rIObj.DistantActionPosition(pPlayer.SkeletonPosition); pPlayer.IsVisible = false; ++pPlayer.mCurrentState; } break; case 3: //-----Durch Felsspalt bewegen----- if (pPlayer.SkeletonPosition == Destination) { Sequences.StartAnimation(pPlayer, Hardcoded.Anim_SlipBack_Gretel); //Wieder "auftauchen" pPlayer.IsVisible = true; ++pPlayer.mCurrentState; break; } Sequences.MoveToPosition(pPlayer, Destination); break; case 4: //-----Wieder komplett da?----- if (Conditions.AnimationComplete(pPlayer)) { Sequences.SetPlayerToIdle(pPlayer); } break; } }
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 Draw(SpriteBatch pSpriteBatch, Player pPlayer, Player pOtherPlayer) { Sequences.DrawActI(ActI, pSpriteBatch, pPlayer, pOtherPlayer); }
public override void Update(Player pPlayer, Player pOtherPlayer) { if (!m2ndState) //KnockOverTree { switch (pPlayer.mCurrentState) { case 0: //-----Zu Position bewegen----- if (Conditions.PlayerAtActionPosition(pPlayer)) { ++pPlayer.mCurrentState; } Sequences.MovePlayerToActionPosition(pPlayer); break; case 1: //-----Richtung bestimmen----- Sequences.StartAnimation(pPlayer, Hardcoded.Anim_KnockOverTree_Up); ActivityInstruction.ThumbstickDirection dir = ActivityInstruction.ThumbstickDirection.None; Vector2 DestinationDelta = rIObj.ActionPosition2 - rIObj.ActionPosition1; DestinationDelta.Normalize(); if (DestinationDelta.Y > Math.Sin(MathHelper.ToRadians(67.5f))) //Runter { dir = ActivityInstruction.ThumbstickDirection.Down; } else if (DestinationDelta.Y > Math.Sin(MathHelper.ToRadians(-22.5f))) //Seitlich { if (DestinationDelta.X < 0) //Links { dir = ActivityInstruction.ThumbstickDirection.Left; } else //Rechts { dir = ActivityInstruction.ThumbstickDirection.Right; } } else //Hoch { dir = ActivityInstruction.ThumbstickDirection.Up; } string animPlayer = Character.GetRightDirectionAnimation(rIObj.ActionPosition2 - rIObj.ActionPosition1, Hardcoded.Anim_KnockOverTree_Up, Hardcoded.Anim_KnockOverTree_Down, Hardcoded.Anim_KnockOverTree_Side); string animTree = Character.GetRightDirectionAnimation(rIObj.ActionPosition2 - rIObj.ActionPosition1, Hardcoded.Anim_Tree_KnockOver_Up, Hardcoded.Anim_Tree_KnockOver_Down, Hardcoded.Anim_Tree_KnockOver_Side); Character.SetSkeletonFlipState(pPlayer, rIObj.ActionPosition2 - rIObj.ActionPosition1); Character.SetSkeletonFlipState(rIObj, rIObj.ActionPosition2 - rIObj.ActionPosition1); Sequences.StartAnimation(pPlayer, animPlayer); Sequences.StartAnimation(rIObj, animTree); ActI.SetThumbstickDir(pPlayer, dir); ActI.SetThumbstickDir(pOtherPlayer, ActivityInstruction.ThumbstickDirection.None); ++pPlayer.mCurrentState; break; case 2: //-----Baum umwerfen----- if (!Conditions.ActionThumbstickPressed(pPlayer, rIObj.ActionPosition2 - rIObj.ActionPosition1)) { ActI.SetFadingState(pPlayer, true); Progress.StepBackward(); } else { ActI.SetFadingState(pPlayer, false, false); Progress.StepForward(); } Sequences.UpdateAnimationStepping(rIObj, Progress.Progress); Sequences.UpdateAnimationStepping(pPlayer, Progress.Progress); if (Progress.Complete) { //Baum fällt string anim = Character.GetRightDirectionAnimation(rIObj.ActionPosition2 - rIObj.ActionPosition1, Hardcoded.Anim_Tree_Falling_Up, Hardcoded.Anim_Tree_Falling_Down, Hardcoded.Anim_Tree_Falling_Side); Sequences.StartAnimation(rIObj, anim); //Sequences.StartAnimation(pPlayer, "attack"); kann weg? ActI.SetFadingState(pPlayer, false); ++pPlayer.mCurrentState; } break; case 3: //-----Baum umgefallen?----- if (Conditions.AnimationComplete(rIObj)) { Sequences.SetPlayerToIdle(pPlayer); m2ndState = true; } break; } ActI.Update(); } else //BalanceOverTree { switch (pPlayer.mCurrentState) { case 0: //-----Zu Position bewegen----- if (!Conditions.ActivityNotInUseByOtherPlayer(pOtherPlayer, this)) { Sequences.SetPlayerToIdle(pPlayer); return; } if (Conditions.PlayerAtNearestActionPosition(pPlayer)) { ++pPlayer.mCurrentState; } Sequences.MovePlayerToNearestActionPosition(pPlayer); break; case 1: //-----Richtung bestimmen----- IsAvailable = false; StartPosition = pPlayer.SkeletonPosition; Direction = rIObj.DistantActionPosition(pPlayer.SkeletonPosition) - StartPosition; Sequences.AnimateAccordingToDirection(pPlayer, Direction, Hardcoded.Anim_Balance_Enter_Up, Hardcoded.Anim_Balance_Enter_Down, Hardcoded.Anim_Balance_Enter_Side); ++pPlayer.mCurrentState; break; case 2: //-----Auf Baum steigen----- Direction.Normalize(); Sequences.SynchMovementToAnimation(pPlayer, pPlayer, StartPosition, StartPosition + (Direction * Hardcoded.KnockOverTree_EnterBalanceDistance)); if (Conditions.AnimationComplete(pPlayer)) { ++pPlayer.mCurrentState; } break; case 3: //-----Auf Baum balancieren----- //Update Movement Vector2 MovementInput = pPlayer.Input.Movement; if (MovementInput == Vector2.Zero) { Sequences.StartAnimation(pPlayer, Hardcoded.Anim_Balance_Idle); break; //Performance quit } //Sideways? Vector2 DirectionTest = rIObj.ActionPosition2 - rIObj.ActionPosition1; DirectionTest.Normalize(); bool Sideways = false; if (DirectionTest.Y <= Math.Sin(MathHelper.ToRadians(45f)) && DirectionTest.Y >= -Math.Sin(MathHelper.ToRadians(45f))) { Sideways = true; } //Runter fallen? if ((MovementInput.X == 0 && MovementInput.Y != 0 && Sideways) || (MovementInput.X != 0 && MovementInput.Y == 0 && !Sideways)) { GameScene.End = true; break; } //BalancingMovement ausführen Sequences.AnimateAccordingToDirection(pPlayer, DirectionTest, Hardcoded.Anim_Balance_Up, Hardcoded.Anim_Balance_Down, Hardcoded.Anim_Balance_Side); pPlayer.MoveAgainstPoint(rIObj.NearestActionPosition(pPlayer.SkeletonPosition + MovementInput * 1000f), Hardcoded.KnockOverTree_BalanceSpeedFactor, null, true, false, false); //Leave Tree? Vector2 TargetActionPosition = rIObj.NearestActionPosition(pPlayer.SkeletonPosition + MovementInput * 1000f); Vector2 MovementDirection = TargetActionPosition - pPlayer.SkeletonPosition; MovementDirection.Normalize(); //Wenn Entfernung vom Player zum TargetActionPoint <= EnterBalanceEntfernung if ((TargetActionPosition - pPlayer.SkeletonPosition).Length() <= (MovementDirection * Hardcoded.KnockOverTree_EnterBalanceDistance).Length()) { ++pPlayer.mCurrentState; StartPosition = pPlayer.SkeletonPosition; Sequences.AnimateAccordingToDirection(pPlayer, MovementDirection, Hardcoded.Anim_Balance_Leave_Up, Hardcoded.Anim_Balance_Leave_Down, Hardcoded.Anim_Balance_Leave_Side); } break; case 4: //-----Von Baum steigen----- Sequences.SynchMovementToAnimation(pPlayer, pPlayer, StartPosition, StartPosition + (Direction * Hardcoded.KnockOverTree_EnterBalanceDistance)); while (pPlayer.CollisionBox.Intersects(pOtherPlayer.CollisionBox)) { pOtherPlayer.MoveManually(Direction); } if (Conditions.AnimationComplete(pPlayer)) { Sequences.SetPlayerToIdle(pPlayer); IsAvailable = true; //pPlayer.mCurrentState = 0; } break; } } }
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(); }
//-----Workaround für linerare Abhängigkeit HG_Game -> HG_Data -> KryptonEngine----- public void SetupInteractiveObjectsFromDeserialization(Savegame pSavegame, Hansel pHansel, Gretel pGretel) { for (int i = 0; i < pSavegame.Scenes.Length; i++) { foreach (InteractiveObject iObj in pSavegame.Scenes[i].InteractiveObjects) { switch (iObj.ActivityId) { case Activity.None: iObj.ActivityState = None; break; case Activity.KnockOverTree: iObj.ActivityState = new KnockOverTree(pHansel, pGretel, iObj); break; case Activity.BalanceOverTree: iObj.ActivityState = new KnockOverTree(pHansel, pGretel, iObj); Sequences.AnimateAccordingToDirection(iObj, iObj.ActionPosition2 - iObj.ActionPosition1, Hardcoded.Anim_Tree_Fallen_Up, Hardcoded.Anim_Tree_Fallen_Down, Hardcoded.Anim_Tree_Fallen_Side); iObj.ActivityState.m2ndState = true; break; case Activity.PushRock: iObj.ActivityState = new PushRock(pHansel, pGretel, iObj); break; case Activity.SlipThroughRock: iObj.ActivityState = new SlipThroughRock(pHansel, pGretel, iObj); break; case Activity.JumpOverGap: iObj.ActivityState = new JumpOverGap(pHansel, pGretel, iObj); break; case Activity.LegUp: iObj.ActivityState = new LegUp(pHansel, pGretel, iObj); break; case Activity.LegUpGrab: iObj.ActivityState = new LegUp(pHansel, pGretel, iObj); iObj.ActivityState.m2ndState = true; break; case Activity.PushDoor: iObj.ActivityState = new PushDoor(pHansel, pGretel, iObj); break; case Activity.PullDoor: throw new Exception("Es gibt keine Tür mehr die von den Spielern geschlossen werden soll"); /*iObj.ActivityState = new PushDoor(pHansel, pGretel, iObj); * Sequences.AnimateAccordingToDirection(iObj, new Vector2(iObj.CollisionRectList[0].X - iObj.ActionRectList[0].X, iObj.CollisionRectList[0].Y - iObj.ActionRectList[0].Y), Hardcoded.Anim_Door_Open_Up, Hardcoded.Anim_Door_Open_Down, Hardcoded.Anim_Door_Open_Side); * iObj.ActivityState.m2ndState = true;*/ break; case Activity.UseWell: iObj.ActivityState = new UseWell(pHansel, pGretel, iObj); break; case Activity.ChargeAmulet: iObj.ActivityState = new ChargeAmulet(pHansel, pGretel, iObj); AmuletStates.Add((ChargeAmulet)iObj.ActivityState); break; default: throw new Exception("Im InteractiveObject " + iObj.ObjectId.ToString() + " in Scene " + i.ToString() + " ist eine ungültige Action angegeben!"); } } } }
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(); }