From fd7e652d9d56a6b06566ba77e5d7f0c82c7751ed Mon Sep 17 00:00:00 2001 From: ThePurpleAnon <100617766+ThePurpleAnon@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:53:04 -0600 Subject: [PATCH] Fixed slides made them fancy :3 (easing, combining the blocks, the works (still no slide animation for the birds tho)) --- Assets/Resources/Games/manzai.prefab | 14 +++--- .../Animations/BothBirds/BirdsSlideIn.anim | 40 +++++++-------- .../Animations/BothBirds/BirdsSlideOut.anim | 40 +++++++-------- Assets/Scripts/Games/Manzai/Manzai.cs | 50 ++++++++++++++----- 4 files changed, 85 insertions(+), 59 deletions(-) diff --git a/Assets/Resources/Games/manzai.prefab b/Assets/Resources/Games/manzai.prefab index 302a738b5..be9c823ea 100644 --- a/Assets/Resources/Games/manzai.prefab +++ b/Assets/Resources/Games/manzai.prefab @@ -1484,7 +1484,6 @@ Transform: - {fileID: 609423043376221866} - {fileID: 5850002581442868008} - {fileID: 7879640242725009620} - - {fileID: 5881063490390799054} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1506,7 +1505,7 @@ MonoBehaviour: RavenAnim: {fileID: 7204459476474823181} HaiBubbleL: {fileID: 8456601383015447979} HaiBubbleR: {fileID: 2672010817748250556} - BothBirdsAnim: {fileID: 0} + BothBirdsAnim: {fileID: 4047821211562032729} --- !u!1 &3161037767898396668 GameObject: m_ObjectHideFlags: 0 @@ -3007,6 +3006,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 5721729477846433201} + - {fileID: 5881063490390799054} m_Father: {fileID: 7879640242725009620} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -4522,15 +4522,15 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8452936147525436988} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -1.3555557, y: 0.44444448, z: 0} + m_LocalScale: {x: 1.1111112, y: 1.1111112, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2929667954241189041} - {fileID: 433795689448701314} - m_Father: {fileID: 3661019275362709209} - m_RootOrder: 3 + m_Father: {fileID: 4470941884995114579} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &8627201407586870289 GameObject: diff --git a/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideIn.anim b/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideIn.anim index 9a64cd340..c7af6dc7f 100644 --- a/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideIn.anim +++ b/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideIn.anim @@ -30,7 +30,7 @@ AnimationClip: - serializedVersion: 3 time: 0.33333334 value: {x: 0, y: 0, z: 0} - inSlope: {x: 0, y: 0, z: 0} + inSlope: {x: -11.4, y: -0, z: -0} outSlope: {x: 0, y: 0, z: 0} tangentMode: 0 weightedMode: 1 @@ -55,7 +55,7 @@ AnimationClip: - serializedVersion: 3 time: 0.33333334 value: {x: 0, y: 0, z: 0} - inSlope: {x: 0, y: 0, z: 0} + inSlope: {x: 11.4, y: -0, z: -0} outSlope: {x: 0, y: 0, z: 0} tangentMode: 0 weightedMode: 1 @@ -119,16 +119,16 @@ AnimationClip: value: 3.8 inSlope: 0 outSlope: -11.4 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -11.4 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -147,16 +147,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -175,16 +175,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -203,16 +203,16 @@ AnimationClip: value: -3.8 inSlope: 0 outSlope: 11.4 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: 11.4 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -231,16 +231,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -259,16 +259,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 diff --git a/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideOut.anim b/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideOut.anim index dc8377cb9..4c26b92a1 100644 --- a/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideOut.anim +++ b/Assets/Resources/Sprites/Games/Manzai/Animations/BothBirds/BirdsSlideOut.anim @@ -30,7 +30,7 @@ AnimationClip: - serializedVersion: 3 time: 0.33333334 value: {x: 3.8, y: 0, z: 0} - inSlope: {x: 0, y: 0, z: 0} + inSlope: {x: 11.4, y: -0, z: -0} outSlope: {x: -12, y: 0, z: 0} tangentMode: 0 weightedMode: 1 @@ -55,7 +55,7 @@ AnimationClip: - serializedVersion: 3 time: 0.33333334 value: {x: -3.8, y: 0, z: 0} - inSlope: {x: 0, y: 0, z: 0} + inSlope: {x: -11.4, y: -0, z: -0} outSlope: {x: 12, y: 0, z: 0} tangentMode: 0 weightedMode: 1 @@ -119,16 +119,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 11.4 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 3.8 - inSlope: 0 + inSlope: 11.4 outSlope: -12 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -147,16 +147,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -175,16 +175,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -203,16 +203,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: -11.4 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: -3.8 - inSlope: 0 + inSlope: -11.4 outSlope: 12 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -231,16 +231,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 @@ -259,16 +259,16 @@ AnimationClip: value: 0 inSlope: 0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 time: 0.33333334 value: 0 - inSlope: 0 + inSlope: -0 outSlope: 0 - tangentMode: 65 + tangentMode: 69 weightedMode: 1 inWeight: 0.33333334 outWeight: 0.33333334 diff --git a/Assets/Scripts/Games/Manzai/Manzai.cs b/Assets/Scripts/Games/Manzai/Manzai.cs index b5c2d443c..96602d697 100644 --- a/Assets/Scripts/Games/Manzai/Manzai.cs +++ b/Assets/Scripts/Games/Manzai/Manzai.cs @@ -58,15 +58,19 @@ namespace HeavenStudio.Games.Loaders function = delegate { Manzai.instance.CustomBoing(eventCaller.currentEntity.beat); }, defaultLength = 0.5f, }, - new GameAction("slidein", "Slide In") + new GameAction("slide", "Birds Slide") { - function = delegate { Manzai.instance.BirdsSlideIn(eventCaller.currentEntity.beat); }, - defaultLength = 0.5f, - }, - new GameAction("slideout", "Slide Out") - { - function = delegate { Manzai.instance.BirdsSlideOut(eventCaller.currentEntity.beat); }, - defaultLength = 0.5f, + function = delegate { + var e = eventCaller.currentEntity; + Manzai.instance.BirdsSlide(e.beat, e.length, e["goToSide"], e["ease"]); + }, + defaultLength = 1f, + resizable = true, + parameters = new List() + { + new Param("goToSide", Manzai.WhichSide.Inside, "Go to Which Side?", "Which side of the stage the birds will move to?"), + new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the movement have?"), + }, }, }); } @@ -105,6 +109,12 @@ namespace HeavenStudio.Games bool ravenBop = true; bool vultureBop = true; + bool isMoving; + double movingStartBeat; + double movingLength; + string moveAnim; + EasingFunction.Ease lastEase; + public enum WhoBops { @@ -158,6 +168,12 @@ namespace HeavenStudio.Games // UmetteUmena, } + public enum WhichSide + { + Inside, + Outside, + } + public static Manzai instance; @@ -326,14 +342,24 @@ namespace HeavenStudio.Games } - public void BirdsSlideIn(double beat) + public void BirdsSlide(double beat, double length, int goToSide, int ease) { - BothBirdsAnim.DoScaledAnimationAsync("SlideIn", 0.5f); + movingStartBeat = beat; + movingLength = length; + moveAnim = (goToSide == 0 ? "SlideIn" : "SlideOut"); + isMoving = true; + lastEase = (EasingFunction.Ease)ease; } - public void BirdsSlideOut(double beat) + private void Update() { - BothBirdsAnim.DoScaledAnimationAsync("SlideOut", 0.5f); + if (isMoving) { + float normalizedBeat = Conductor.instance.GetPositionFromBeat(movingStartBeat, movingLength); + EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase); + float newPos = func(0f, 1f, normalizedBeat); + BothBirdsAnim.DoNormalizedAnimation(moveAnim, newPos); + if (normalizedBeat >= 1f) isMoving = false; + } } } }