From 837b52fcbd12c7033ebcf9236ea3552b3e443e1d Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Thu, 22 Jun 2023 22:27:23 +0200 Subject: [PATCH] Implemented falling :( --- .../Animations/Platform/Destroy.anim | 459 ++++++++++++++++++ .../Animations/Platform/Destroy.anim.meta | 8 + .../Platform/JumpPlatform.controller | 29 ++ .../Scripts/Games/NightWalkAgb/AgbPlatform.cs | 25 +- .../Games/NightWalkAgb/AgbPlatformHandler.cs | 17 + 5 files changed, 537 insertions(+), 1 deletion(-) create mode 100644 Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim create mode 100644 Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim.meta diff --git a/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim b/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim new file mode 100644 index 000000000..f85d43f10 --- /dev/null +++ b/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim @@ -0,0 +1,459 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Destroy + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.19, y: 0.97, z: 0} + inSlope: {x: Infinity, y: 0, z: 0} + outSlope: {x: Infinity, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Rod + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 2.074, y: 6.574, z: 0} + inSlope: {x: Infinity, y: 0, z: 0} + outSlope: {x: Infinity, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: platform + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Rod/light + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Color.a + path: Rod + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Color.a + path: platform + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Rod/stem + classID: 1 + script: {fileID: 0} + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: 1455939149, guid: 425aa48453840844d9f049d7ebd849ce, type: 3} + attribute: m_Sprite + path: Rod + classID: 212 + script: {fileID: 0} + - curve: + - time: 0 + value: {fileID: 572682246, guid: 425aa48453840844d9f049d7ebd849ce, type: 3} + attribute: m_Sprite + path: platform + classID: 212 + script: {fileID: 0} + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 952365541 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 961728715 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 2539502518 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 952365541 + attribute: 304273561 + script: {fileID: 0} + typeID: 212 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 961728715 + attribute: 304273561 + script: {fileID: 0} + typeID: 212 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 3738218430 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 952365541 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + - serializedVersion: 2 + path: 961728715 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + pptrCurveMapping: + - {fileID: 1455939149, guid: 425aa48453840844d9f049d7ebd849ce, type: 3} + - {fileID: 572682246, guid: 425aa48453840844d9f049d7ebd849ce, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.05 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Rod/light + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.19 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: Rod + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.97 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: Rod + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: Rod + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 2.074 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: platform + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 6.574 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: platform + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: platform + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Color.a + path: Rod + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.05 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Color.a + path: platform + classID: 212 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Rod/stem + classID: 1 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim.meta b/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim.meta new file mode 100644 index 000000000..d5a0f0b48 --- /dev/null +++ b/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/Destroy.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6d5a5acec731a3341884571fde9c0727 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/JumpPlatform.controller b/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/JumpPlatform.controller index 33747490d..07a3cb184 100644 --- a/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/JumpPlatform.controller +++ b/Assets/Resources/Sprites/Games/NightWalkGBA/Animations/Platform/JumpPlatform.controller @@ -56,6 +56,9 @@ AnimatorStateMachine: - serializedVersion: 1 m_State: {fileID: -9111166599128444203} m_Position: {x: 410, y: 390, z: 0} + - serializedVersion: 1 + m_State: {fileID: 5044809879433215610} + m_Position: {x: 445, y: 455, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] @@ -189,6 +192,32 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1102 &5044809879433215610 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Destroy + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 6d5a5acec731a3341884571fde9c0727, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: --- !u!1102 &5402886889881891288 AnimatorState: serializedVersion: 6 diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs index fb8241a87..a1dfa76d6 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs @@ -15,7 +15,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk Umbrella = 3 } private double startBeat; - private double endBeat; + [NonSerialized] public double endBeat; [NonSerialized] public AgbPlatformHandler handler; private Animator anim; @@ -35,6 +35,8 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk private bool stopped; private Sound kickSound; [SerializeField] private GameObject fallYan; + private bool playYanIsFalling; + private double playYanFallBeat; public void StartInput(double beat, double hitBeat) { @@ -139,6 +141,13 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk ResetInput(); } } + if (playYanIsFalling) + { + float normalizedFallBeat = cond.GetPositionFromBeat(playYanFallBeat, 2); + EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInQuad); + float newPlayYanY = func(0, -12, normalizedFallBeat); + fallYan.transform.localPosition = new Vector3(0, newPlayYanY); + } } } @@ -149,6 +158,19 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk if (kickSound != null) kickSound.Delete(); } + public void Disappear(double beat) + { + anim.DoScaledAnimationAsync("Destroy", 0.5f); + SoundByte.PlayOneShotGame("nightWalkAgb/disappear"); + if (fallYan.activeSelf) + { + SoundByte.PlayOneShotGame("nightWalkAgb/fall"); + playYanIsFalling = true; + playYanFallBeat = beat; + Update(); + } + } + private void ResetInput() { double newStartBeat = endBeat + (handler.platformCount * 0.5f); @@ -194,6 +216,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk else { handler.StopAll(); + handler.DestroyPlatforms(caller.timer + caller.startBeat + 2, endBeat - 3, endBeat + 6); SoundByte.PlayOneShotGame("nightWalkAgb/wot"); game.playYan.Hide(); fallYan.SetActive(true); diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs index 84df6bba1..a6b045c29 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs @@ -78,6 +78,23 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk } } + public void DestroyPlatforms(double startBeat, double firstBeat, double lastBeat) + { + List platformsToDestroy = allPlatforms.FindAll(x => x.endBeat >= firstBeat && x.endBeat <= lastBeat); + platformsToDestroy.Sort((x, y) => x.endBeat.CompareTo(y.endBeat)); + List actions = new(); + for (int i = 0; i < platformsToDestroy.Count; i++) + { + AgbPlatform currentPlatformToDdestroy = platformsToDestroy[i]; + double fallBeat = startBeat + i; + actions.Add(new BeatAction.Action(fallBeat, delegate + { + currentPlatformToDdestroy.Disappear(fallBeat); + })); + } + BeatAction.New(gameObject, actions); + } + public void RaiseHeight(double beat, int lastUnits, int currentUnits) { raiseBeat = beat;