From 04d79f53cef01a772c635ee9ce48a7c6c54987c2 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Mon, 27 Feb 2023 21:13:10 +0100 Subject: [PATCH] Space dance improvements/additions + launch party rotation fix (#321) * Almost done with space dance stuff additions * Space dance improvements and additions * Removed WIP text from Space Dance * Removed WIP text from launch party and kitties and made the launch pad rotation actually be in the center of the launch pad --- Assets/Resources/Games/launchParty.prefab | 3 +- Assets/Resources/Games/spaceDance.prefab | 38 +- .../Animations/shootingStar.controller | 25 +- Assets/Scripts/Games/Kitties/Kitties.cs | 2 +- .../Scripts/Games/LaunchParty/LaunchParty.cs | 11 +- Assets/Scripts/Games/SpaceDance/SpaceDance.cs | 546 ++++++++++++++---- 6 files changed, 490 insertions(+), 135 deletions(-) diff --git a/Assets/Resources/Games/launchParty.prefab b/Assets/Resources/Games/launchParty.prefab index e7ee4f39..cf9fa3a0 100644 --- a/Assets/Resources/Games/launchParty.prefab +++ b/Assets/Resources/Games/launchParty.prefab @@ -25,7 +25,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 71292151208428887} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0.6536391, y: -2.3077297, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 5.5, y: 5.5, z: 1} m_Children: - {fileID: 6814980013608003628} @@ -959,6 +959,7 @@ MonoBehaviour: fallingStars: {fileID: 7808760023856068891} fallingStarsBack: {fileID: 8460598887616071446} launchPad: {fileID: 1878559053619328651} + launchPadRotatable: {fileID: 6814980013608003628} spawnPad: {fileID: 6143638777909239727} scrollScript: {fileID: 3015934657586124713} lensFlareAnim: {fileID: 3332192496224597064} diff --git a/Assets/Resources/Games/spaceDance.prefab b/Assets/Resources/Games/spaceDance.prefab index 6f5a09af..7841354f 100644 --- a/Assets/Resources/Games/spaceDance.prefab +++ b/Assets/Resources/Games/spaceDance.prefab @@ -158,7 +158,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 0.84, y: 0.88} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -240,7 +240,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 1.06, y: 1.06} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -322,7 +322,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 1.06, y: 1.06} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -621,7 +621,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 1.06, y: 1.06} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -785,7 +785,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 0.84, y: 0.88} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -1116,7 +1116,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 1.06, y: 1.06} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -1198,7 +1198,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 0.84, y: 0.88} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -1445,7 +1445,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 1.06, y: 1.06} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -1477,7 +1477,7 @@ Transform: m_GameObject: {fileID: 2553831158572278799} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 18, y: 10.8, z: 1} + m_LocalScale: {x: 200, y: 200, z: 1} m_Children: [] m_Father: {fileID: 2641675102161953886} m_RootOrder: 0 @@ -1853,16 +1853,20 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8dbd5e988233f9a4f931eddbafe8719a, type: 3} m_Name: m_EditorClassIdentifier: + SoundSequences: [] EligibleHits: [] scheduledInputs: [] firstEnable: 0 + bg: {fileID: 2610373406746728028} + shootingStarAnim: {fileID: 4983040283415321214} DancerP: {fileID: 3296520271412479276} Dancer1: {fileID: 2061330976302630762} Dancer2: {fileID: 8384936998978932668} Dancer3: {fileID: 5910735516540692712} - Gramps: {fileID: 0} + Gramps: {fileID: 1816821696199921329} Hit: {fileID: 5303799939770479509} Player: {fileID: 2020085808268724872} + shouldBop: 0 --- !u!1 &4074854792918107558 GameObject: m_ObjectHideFlags: 0 @@ -2044,7 +2048,7 @@ SpriteRenderer: m_Size: {x: 1, y: 1} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 + m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 --- !u!1 &4645550827212076490 @@ -2123,7 +2127,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 0.84, y: 0.88} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -2409,7 +2413,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 0.84, y: 0.88} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -2641,7 +2645,7 @@ SpriteRenderer: m_Size: {x: 1, y: 1} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 + m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 --- !u!1 &7791357165261869293 @@ -2720,7 +2724,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 1.06, y: 1.06} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -2802,7 +2806,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 0.84, y: 0.88} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 @@ -2986,7 +2990,7 @@ SpriteRenderer: m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.66, y: 0.66} + m_Size: {x: 0.84, y: 0.88} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 0 diff --git a/Assets/Resources/Sprites/Games/SpaceDance/Animations/shootingStar.controller b/Assets/Resources/Sprites/Games/SpaceDance/Animations/shootingStar.controller index dc407857..3060d97c 100644 --- a/Assets/Resources/Sprites/Games/SpaceDance/Animations/shootingStar.controller +++ b/Assets/Resources/Sprites/Games/SpaceDance/Animations/shootingStar.controller @@ -10,7 +10,8 @@ AnimatorState: m_Name: ShootingStar m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -6958187446952554106} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -26,6 +27,28 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &-6958187446952554106 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 644594833260699} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!91 &9100000 AnimatorController: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Games/Kitties/Kitties.cs b/Assets/Scripts/Games/Kitties/Kitties.cs index a1832106..3217ff16 100644 --- a/Assets/Scripts/Games/Kitties/Kitties.cs +++ b/Assets/Scripts/Games/Kitties/Kitties.cs @@ -10,7 +10,7 @@ namespace HeavenStudio.Games.Loaders { public static Minigame AddGame(EventCaller eventCaller) { - return new Minigame("kitties", "Kitties! \n[WIP]", "0058CE", false, false, new List() + return new Minigame("kitties", "Kitties!", "0058CE", false, false, new List() { new GameAction("clap", "Cat Clap") { diff --git a/Assets/Scripts/Games/LaunchParty/LaunchParty.cs b/Assets/Scripts/Games/LaunchParty/LaunchParty.cs index af803451..8a6237f9 100644 --- a/Assets/Scripts/Games/LaunchParty/LaunchParty.cs +++ b/Assets/Scripts/Games/LaunchParty/LaunchParty.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Loaders { public static Minigame AddGame(EventCaller eventCaller) { - return new Minigame("launchParty", "Launch Party \n[WIP]", "000000", false, false, new List() + return new Minigame("launchParty", "Launch Party", "000000", false, false, new List() { new GameAction("rocket", "Family Model") { @@ -155,6 +155,7 @@ namespace HeavenStudio.Games [SerializeField] ParticleSystem fallingStars; [SerializeField] ParticleSystem fallingStarsBack; [SerializeField] Transform launchPad; + [SerializeField] Transform launchPadRotatable; [SerializeField] Transform spawnPad; [SerializeField] Scroll scrollScript; [SerializeField] Animator lensFlareAnim; @@ -302,20 +303,20 @@ namespace HeavenStudio.Games { if (normalizedBeat > 1) { - launchPad.rotation = Quaternion.Euler(0, 0, currentPadRotation); + launchPadRotatable.rotation = Quaternion.Euler(0, 0, currentPadRotation); } else { if (currentRotLength < 0) { - launchPad.rotation = Quaternion.Euler(0, 0, currentPadRotation); + launchPadRotatable.rotation = Quaternion.Euler(0, 0, currentPadRotation); } else { EasingFunction.Function func = EasingFunction.GetEasingFunction(lastRotEase); float newRotZ = func(lastPadRotation, currentPadRotation, normalizedBeat); - launchPad.rotation = Quaternion.Euler(0, 0, newRotZ); + launchPadRotatable.rotation = Quaternion.Euler(0, 0, newRotZ); } } } @@ -343,7 +344,7 @@ namespace HeavenStudio.Games { if (currentRotIndex < allRotEvents.Count && currentRotIndex >= 0) { - lastPadRotation = launchPad.rotation.eulerAngles.z; + lastPadRotation = launchPadRotatable.rotation.eulerAngles.z; currentRotBeat = allRotEvents[currentRotIndex].beat; currentRotLength = allRotEvents[currentRotIndex].length; currentPadRotation = allRotEvents[currentRotIndex]["rot"]; diff --git a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs index 33a7b33f..8375f47c 100644 --- a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs +++ b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs @@ -2,6 +2,8 @@ using HeavenStudio.Util; using System; using System.Collections.Generic; using UnityEngine; +using DG.Tweening; +using static HeavenStudio.Games.SpaceDance; namespace HeavenStudio.Games.Loaders { @@ -9,27 +11,78 @@ namespace HeavenStudio.Games.Loaders public static class AgbSpaceDanceLoader { public static Minigame AddGame(EventCaller eventCaller) { - return new Minigame("spaceDance", "Space Dance \n[WIP]", "FFFF34", false, false, new List() + return new Minigame("spaceDance", "Space Dance", "FFFF34", false, false, new List() { new GameAction("turn right", "Turn Right") { - function = delegate { SpaceDance.instance.DoTurnRight(eventCaller.currentEntity.beat); }, - defaultLength = 2.0f, + function = delegate { var e = eventCaller.currentEntity; SpaceDance.instance.DoTurnRight(e.beat, e["whoSpeaks"], e["gramps"]); }, + defaultLength = 2.0f, + parameters = new List() + { + new Param("whoSpeaks", SpaceDance.WhoSpeaks.Dancers, "Who Speaks?", "Who will say the voice line for the cue?"), + new Param("gramps", false, "Space Gramps Animations", "Will Space Gramps turn right?") + } }, new GameAction("sit down", "Sit Down") { - function = delegate { SpaceDance.instance.DoSitDown(eventCaller.currentEntity.beat); }, - defaultLength = 2.0f, + function = delegate { var e = eventCaller.currentEntity; SpaceDance.instance.DoSitDown(e.beat, e["whoSpeaks"], e["gramps"]); }, + defaultLength = 2.0f, + parameters = new List() + { + new Param("whoSpeaks", SpaceDance.WhoSpeaks.Dancers, "Who Speaks?", "Who will say the voice line for the cue?"), + new Param("gramps", false, "Space Gramps Animations", "Will Space Gramps turn right?") + } }, new GameAction("punch", "Punch") { - function = delegate { SpaceDance.instance.DoPunch(eventCaller.currentEntity.beat); }, - defaultLength = 2.0f, + function = delegate { var e = eventCaller.currentEntity; SpaceDance.instance.DoPunch(e.beat, e["whoSpeaks"], e["gramps"]); }, + defaultLength = 2.0f, + parameters = new List() + { + new Param("whoSpeaks", SpaceDance.WhoSpeaks.Dancers, "Who Speaks?", "Who will say the voice line for the cue?"), + new Param("gramps", false, "Space Gramps Animations", "Will Space Gramps turn right?") + } }, - new GameAction("bop", "Bop") + new GameAction("shootingStar", "Shooting Star") { - function = delegate { SpaceDance.instance.Bop(eventCaller.currentEntity.beat); }, + function = delegate { var e = eventCaller.currentEntity; SpaceDance.instance.UpdateShootingStar(e.beat, e.length, e["ease"]); }, + defaultLength = 2f, + resizable = true, + parameters = new List() + { + new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the shooting of the stars use?") + } }, + new GameAction("changeBG", "Change Background Color") + { + function = delegate {var e = eventCaller.currentEntity; SpaceDance.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["toggle"]); }, + defaultLength = 1f, + resizable = true, + parameters = new List() + { + new Param("start", SpaceDance.defaultBGColor, "Start Color", "The start color for the fade or the color that will be switched to if -instant- is ticked on."), + new Param("end", SpaceDance.defaultBGColor, "End Color", "The end color for the fade."), + new Param("toggle", false, "Instant", "Should the background instantly change color?") + } + }, + new GameAction("bop", "Single Bop") + { + function = delegate { SpaceDance.instance.Bop(); SpaceDance.instance.GrampsBop(eventCaller.currentEntity["gramps"]); }, + parameters = new List() + { + new Param("gramps", false, "Gramps Bop", "Should Space Gramps bop with the dancers?") + } + }, + new GameAction("bopToggle", "Bop Toggle") + { + function = delegate { SpaceDance.instance.shouldBop = eventCaller.currentEntity["toggle"]; SpaceDance.instance.spaceGrampsShouldBop = eventCaller.currentEntity["gramps"]; }, + defaultLength = 0.5f, + parameters = new List() + { + new Param("toggle", true, "Should bop?", "Should the dancers bop?"), + new Param("gramps", false, "Gramps Bop", "Should Space Gramps bop with the dancers?") + } + } }); } } @@ -40,6 +93,24 @@ namespace HeavenStudio.Games // using Scripts_SpaceDance; public class SpaceDance : Minigame { + private static Color _defaultBGColor; + public static Color defaultBGColor + { + get + { + ColorUtility.TryParseHtmlString("#0014D6", out _defaultBGColor); + return _defaultBGColor; + } + } + public enum WhoSpeaks + { + Dancers = 0, + Gramps = 1, + Both = 2 + } + Tween bgColorTween; + [SerializeField] SpriteRenderer bg; + [SerializeField] Animator shootingStarAnim; public Animator DancerP; public Animator Dancer1; public Animator Dancer2; @@ -47,6 +118,16 @@ namespace HeavenStudio.Games public Animator Gramps; public Animator Hit; public GameObject Player; + public bool shouldBop = false; + bool canBop = true; + bool grampsCanBop = true; + public bool spaceGrampsShouldBop = false; + float shootingStarLength; + float shootingStarStartBeat; + EasingFunction.Ease lastEase; + bool isShootingStar; + + public GameEvent bop = new GameEvent(); public static SpaceDance instance; @@ -59,158 +140,403 @@ namespace HeavenStudio.Games // Update is called once per frame void Update() { - - if (PlayerInput.Pressed() && !IsExpectingInputNow()) + var cond = Conductor.instance; + if (cond.isPlaying && !cond.isPaused) { - Jukebox.PlayOneShotGame("spaceDance/inputBad"); - // Look at this later, sound effect has some weird clipping on it sometimes?? popping. like. fucking popopop idk why its doing that its fine theres no sample weirdness ughh + if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) + { + if (shouldBop && canBop) + { + Bop(); + } + if (spaceGrampsShouldBop && grampsCanBop) + { + GrampsBop(); + } + } + if (isShootingStar) + { + float normalizedBeat = cond.GetPositionFromBeat(shootingStarStartBeat, shootingStarLength); + if (normalizedBeat >= 0) + { + if (normalizedBeat > 1) + { + isShootingStar = false; + } + else + { + EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase); + float newAnimPos = func(0f, 1f, normalizedBeat); + shootingStarAnim.DoNormalizedAnimation("ShootingStar", newAnimPos); + } + } + } + if (!DancerP.IsPlayingAnimationName("PunchDo") && !DancerP.IsPlayingAnimationName("TurnRightDo") && !DancerP.IsPlayingAnimationName("SitDownDo")) + { + if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) + { + Jukebox.PlayOneShotGame("spaceDance/inputBad"); + DancerP.DoScaledAnimationAsync("PunchDo", 0.5f); + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + // Look at this later, sound effect has some weird clipping on it sometimes?? popping. like. fucking popopop idk why its doing that its fine theres no sample weirdness ughh + } + if (PlayerInput.GetSpecificDirectionDown(1) && !IsExpectingInputNow(InputType.DIRECTION_RIGHT_DOWN)) + { + DancerP.DoScaledAnimationAsync("TurnRightDo", 0.5f); + Jukebox.PlayOneShotGame("spaceDance/inputBad"); + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + } + if (PlayerInput.GetSpecificDirectionDown(2) && !IsExpectingInputNow(InputType.DIRECTION_DOWN_DOWN)) + { + DancerP.DoScaledAnimationAsync("SitDownDo", 0.5f); + Jukebox.PlayOneShotGame("spaceDance/inputBad"); + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + } + } } } - public void DoTurnRight(float beat) + public void UpdateShootingStar(float beat, float length, int ease) { - ScheduleInput(beat, 1f, InputType.DIRECTION_RIGHT_DOWN, RightSuccess, RightMiss, RightEmpty); - MultiSound.Play(new MultiSound.Sound[] { - new MultiSound.Sound("spaceDance/voicelessTurn", beat), - new MultiSound.Sound("spaceDance/dancerTurn", beat), - new MultiSound.Sound("spaceDance/dancerRight", beat + 1.0f), + lastEase = (EasingFunction.Ease)ease; + shootingStarLength = length; + shootingStarStartBeat = beat; + isShootingStar = true; + } + + public void DoTurnRight(float beat, int whoSpeaks, bool grampsTurns) + { + canBop = false; + if (grampsTurns) grampsCanBop = false; + ScheduleInput(beat, 1f, InputType.DIRECTION_RIGHT_DOWN, JustRight, RightMiss, Empty); + + List soundsToPlay = new List() + { + new MultiSound.Sound("spaceDance/voicelessTurn", beat), + }; + + switch (whoSpeaks) + { + case (int)WhoSpeaks.Dancers: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/dancerTurn", beat), + new MultiSound.Sound("spaceDance/dancerRight", beat + 1.0f), + }); + break; + case (int)WhoSpeaks.Gramps: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/otherTurn", beat), + new MultiSound.Sound("spaceDance/otherRight", beat + 1.0f), + }); + break; + case (int)WhoSpeaks.Both: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/dancerTurn", beat), + new MultiSound.Sound("spaceDance/dancerRight", beat + 1.0f), + new MultiSound.Sound("spaceDance/otherTurn", beat), + new MultiSound.Sound("spaceDance/otherRight", beat + 1.0f), + }); + break; + } + + MultiSound.Play(soundsToPlay.ToArray()); + + BeatAction.New(Player, new List() + { + new BeatAction.Action(beat, delegate { DancerP.DoScaledAnimationAsync("TurnRightStart", 0.5f);}), + new BeatAction.Action(beat, delegate { Dancer1.DoScaledAnimationAsync("TurnRightStart", 0.5f);}), + new BeatAction.Action(beat, delegate { Dancer2.DoScaledAnimationAsync("TurnRightStart", 0.5f);}), + new BeatAction.Action(beat, delegate + { + Dancer3.DoScaledAnimationAsync("TurnRightStart", 0.5f); + if (grampsTurns) Gramps.DoScaledAnimationAsync("GrampsTurnRightStart", 0.5f); + }), + new BeatAction.Action(beat + 1f, delegate { Dancer1.DoScaledAnimationAsync("TurnRightDo", 0.5f);}), + new BeatAction.Action(beat + 1f, delegate { Dancer2.DoScaledAnimationAsync("TurnRightDo", 0.5f);}), + new BeatAction.Action(beat + 1f, delegate + { + Dancer3.DoScaledAnimationAsync("TurnRightDo", 0.5f); + if (grampsTurns) Gramps.DoScaledAnimationAsync("GrampsTurnRightDo", 0.5f); + }), + new BeatAction.Action(beat + 1.99f, delegate { canBop = true; grampsCanBop = true; }), }); - BeatAction.New(Player, new List() - { - new BeatAction.Action(beat, delegate { DancerP.Play("TurnRightStart", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer1.Play("TurnRightStart", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer2.Play("TurnRightStart", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer3.Play("TurnRightStart", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer1.Play("TurnRightDo", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer2.Play("TurnRightDo", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer3.Play("TurnRightDo", -1, 0);}), - }); - } - public void DoSitDown(float beat) + public void DoSitDown(float beat, int whoSpeaks, bool grampsSits) { - ScheduleInput(beat, 1f, InputType.DIRECTION_DOWN_DOWN, SitSuccess, SitMiss, SitEmpty); - MultiSound.Play(new MultiSound.Sound[] { - new MultiSound.Sound("spaceDance/voicelessSit", beat), - new MultiSound.Sound("spaceDance/dancerLets", beat), - new MultiSound.Sound("spaceDance/dancerSit", beat + 0.5f), - new MultiSound.Sound("spaceDance/dancerDown", beat + 1f), + canBop = false; + if (grampsSits) grampsCanBop = false; + ScheduleInput(beat, 1f, InputType.DIRECTION_DOWN_DOWN, JustSit, SitMiss, Empty); + List soundsToPlay = new List() + { + new MultiSound.Sound("spaceDance/voicelessSit", beat), + }; + + switch (whoSpeaks) + { + case (int)WhoSpeaks.Dancers: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/dancerLets", beat), + new MultiSound.Sound("spaceDance/dancerSit", beat + 0.5f), + new MultiSound.Sound("spaceDance/dancerDown", beat + 1f), + }); + break; + case (int)WhoSpeaks.Gramps: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/otherLets", beat), + new MultiSound.Sound("spaceDance/otherSit", beat + 0.5f, 1, 1, false, 0.084f), + new MultiSound.Sound("spaceDance/otherDown", beat + 1f), + }); + break; + case (int)WhoSpeaks.Both: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/dancerLets", beat), + new MultiSound.Sound("spaceDance/dancerSit", beat + 0.5f), + new MultiSound.Sound("spaceDance/dancerDown", beat + 1f), + new MultiSound.Sound("spaceDance/otherLets", beat), + new MultiSound.Sound("spaceDance/otherSit", beat + 0.5f, 1, 1, false, 0.084f), + new MultiSound.Sound("spaceDance/otherDown", beat + 1f), + }); + break; + } + + MultiSound.Play(soundsToPlay.ToArray()); + + BeatAction.New(Player, new List() + { + new BeatAction.Action(beat, delegate { DancerP.DoScaledAnimationAsync("SitDownStart", 0.5f);}), + new BeatAction.Action(beat, delegate { Dancer1.DoScaledAnimationAsync("SitDownStart", 0.5f);}), + new BeatAction.Action(beat, delegate { Dancer2.DoScaledAnimationAsync("SitDownStart", 0.5f);}), + new BeatAction.Action(beat, delegate + { + Dancer3.DoScaledAnimationAsync("SitDownStart", 0.5f); + if (grampsSits) Gramps.DoScaledAnimationAsync("GrampsSitDownStart", 0.5f); + }), + new BeatAction.Action(beat + 1f, delegate { Dancer1.DoScaledAnimationAsync("SitDownDo", 0.5f);}), + new BeatAction.Action(beat + 1f, delegate { Dancer2.DoScaledAnimationAsync("SitDownDo", 0.5f);}), + new BeatAction.Action(beat + 1f, delegate + { + Dancer3.DoScaledAnimationAsync("SitDownDo", 0.5f); + if (grampsSits) Gramps.DoScaledAnimationAsync("GrampsSitDownDo", 0.5f); + }), + new BeatAction.Action(beat + 1.99f, delegate { canBop = true; grampsCanBop = true; }), }); - BeatAction.New(Player, new List() - { - new BeatAction.Action(beat, delegate { DancerP.Play("SitDownStart", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer1.Play("SitDownStart", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer2.Play("SitDownStart", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer3.Play("SitDownStart", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer1.Play("SitDownDo", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer2.Play("SitDownDo", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer3.Play("SitDownDo", -1, 0);}), - }); - } - public void DoPunch(float beat) + public void DoPunch(float beat, int whoSpeaks, bool grampsPunches) { - ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, PunchSuccess, PunchMiss, PunchEmpty); - MultiSound.Play(new MultiSound.Sound[] { - new MultiSound.Sound("spaceDance/voicelessPunch", beat), - new MultiSound.Sound("spaceDance/dancerPa", beat), - new MultiSound.Sound("spaceDance/voicelessPunch", beat + 0.5f), - new MultiSound.Sound("spaceDance/dancerPa", beat + 0.5f), - new MultiSound.Sound("spaceDance/voicelessPunch", beat + 1f), - new MultiSound.Sound("spaceDance/dancerPa", beat + 1f), - new MultiSound.Sound("spaceDance/dancerPunch", beat + 1.5f), - }); + canBop = false; + if (grampsPunches) grampsCanBop = false; + ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, JustPunch, PunchMiss, Empty); + List soundsToPlay = new List() + { + new MultiSound.Sound("spaceDance/voicelessPunch", beat), + new MultiSound.Sound("spaceDance/voicelessPunch", beat + 0.5f), + new MultiSound.Sound("spaceDance/voicelessPunch", beat + 1f), + }; + + switch (whoSpeaks) + { + case (int)WhoSpeaks.Dancers: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/dancerPa", beat), + new MultiSound.Sound("spaceDance/dancerPa", beat + 0.5f), + new MultiSound.Sound("spaceDance/dancerPa", beat + 1f), + new MultiSound.Sound("spaceDance/dancerPunch", beat + 1.5f), + }); + break; + case (int)WhoSpeaks.Gramps: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/otherPa", beat), + new MultiSound.Sound("spaceDance/otherPa", beat + 0.5f), + new MultiSound.Sound("spaceDance/otherPa", beat + 1f), + new MultiSound.Sound("spaceDance/otherPunch", beat + 1.5f), + }); + break; + case (int)WhoSpeaks.Both: + soundsToPlay.AddRange(new List() + { + new MultiSound.Sound("spaceDance/dancerPa", beat), + new MultiSound.Sound("spaceDance/dancerPa", beat + 0.5f), + new MultiSound.Sound("spaceDance/dancerPa", beat + 1f), + new MultiSound.Sound("spaceDance/dancerPunch", beat + 1.5f), + new MultiSound.Sound("spaceDance/otherPa", beat), + new MultiSound.Sound("spaceDance/otherPa", beat + 0.5f), + new MultiSound.Sound("spaceDance/otherPa", beat + 1f), + new MultiSound.Sound("spaceDance/otherPunch", beat + 1.5f), + }); + break; + } + + MultiSound.Play(soundsToPlay.ToArray()); BeatAction.New(Player, new List() { - new BeatAction.Action(beat, delegate { DancerP.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer1.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer2.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer3.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat + 0.5f, delegate { DancerP.Play("PunchStartOuter", -1, 0);}), - new BeatAction.Action(beat + 0.5f, delegate { Dancer1.Play("PunchStartOuter", -1, 0);}), - new BeatAction.Action(beat + 0.5f, delegate { Dancer2.Play("PunchStartOuter", -1, 0);}), - new BeatAction.Action(beat + 0.5f, delegate { Dancer3.Play("PunchStartOuter", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { DancerP.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer1.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer2.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat + 1f, delegate { Dancer3.Play("PunchStartInner", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { Dancer1.Play("PunchDo", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { Dancer2.Play("PunchDo", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { Dancer3.Play("PunchDo", -1, 0);}), + new BeatAction.Action(beat, delegate { DancerP.DoScaledAnimationAsync("PunchStartInner", 0.5f);}), + new BeatAction.Action(beat, delegate { Dancer1.DoScaledAnimationAsync("PunchStartInner", 0.5f);}), + new BeatAction.Action(beat, delegate { Dancer2.DoScaledAnimationAsync("PunchStartInner", 0.5f);}), + new BeatAction.Action(beat, delegate + { + Dancer3.DoScaledAnimationAsync("PunchStartInner", 0.5f); + if (grampsPunches) Gramps.DoScaledAnimationAsync("GrampsPunchStartOdd", 0.5f); + }), + new BeatAction.Action(beat + 0.5f, delegate { DancerP.DoScaledAnimationAsync("PunchStartOuter", 0.5f);}), + new BeatAction.Action(beat + 0.5f, delegate { Dancer1.DoScaledAnimationAsync("PunchStartOuter", 0.5f);}), + new BeatAction.Action(beat + 0.5f, delegate { Dancer2.DoScaledAnimationAsync("PunchStartOuter", 0.5f);}), + new BeatAction.Action(beat + 0.5f, delegate + { + Dancer3.DoScaledAnimationAsync("PunchStartOuter", 0.5f); + if (grampsPunches) Gramps.DoScaledAnimationAsync("GrampsPunchStartEven", 0.5f); + }), + new BeatAction.Action(beat + 1f, delegate { DancerP.DoScaledAnimationAsync("PunchStartInner", 0.5f);}), + new BeatAction.Action(beat + 1f, delegate { Dancer1.DoScaledAnimationAsync("PunchStartInner", 0.5f);}), + new BeatAction.Action(beat + 1f, delegate { Dancer2.DoScaledAnimationAsync("PunchStartInner", 0.5f);}), + new BeatAction.Action(beat + 1f, delegate + { + Dancer3.DoScaledAnimationAsync("PunchStartInner", 0.5f); + if (grampsPunches) Gramps.DoScaledAnimationAsync("GrampsPunchStartOdd", 0.5f); + }), + new BeatAction.Action(beat + 1.5f, delegate { Dancer1.DoScaledAnimationAsync("PunchDo", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { Dancer2.DoScaledAnimationAsync("PunchDo", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate + { + Dancer3.DoScaledAnimationAsync("PunchDo", 0.5f); + if (grampsPunches) Gramps.DoScaledAnimationAsync("GrampsPunchDo", 0.5f); + }), }); } - public void Bop(float beat) + public void Bop() { - BeatAction.New(Player, new List() - { - new BeatAction.Action(beat, delegate { DancerP.Play("Bop", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer1.Play("Bop", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer2.Play("Bop", -1, 0);}), - new BeatAction.Action(beat, delegate { Dancer3.Play("Bop", -1, 0);}), - }); - + canBop = true; + DancerP.DoScaledAnimationAsync("Bop", 0.5f); + Dancer1.DoScaledAnimationAsync("Bop", 0.5f); + Dancer2.DoScaledAnimationAsync("Bop", 0.5f); + Dancer3.DoScaledAnimationAsync("Bop", 0.5f); } - public void RightSuccess(PlayerActionEvent caller, float state) + public void GrampsBop(bool forceBop = false) + { + if (spaceGrampsShouldBop || forceBop) + { + grampsCanBop = true; + Gramps.DoScaledAnimationAsync("GrampsBop", 0.5f); + } + } + + public void ChangeBackgroundColor(Color color, float beats) + { + var seconds = Conductor.instance.secPerBeat * beats; + + if (bgColorTween != null) + bgColorTween.Kill(true); + + if (seconds == 0) + { + bg.color = color; + } + else + { + bgColorTween = bg.DOColor(color, seconds); + } + } + + public void FadeBackgroundColor(Color start, Color end, float beats, bool instant) + { + ChangeBackgroundColor(start, 0f); + if (!instant) ChangeBackgroundColor(end, beats); + } + + public void JustRight(PlayerActionEvent caller, float state) + { + if (state >= 1f || state <= -1f) + { + Jukebox.PlayOneShotGame("spaceDance/inputBad"); + DancerP.DoScaledAnimationAsync("TurnRightDo", 0.5f); + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + return; + } + RightSuccess(); + } + + public void RightSuccess() { Jukebox.PlayOneShotGame("spaceDance/inputGood"); - DancerP.Play("TurnRightDo", -1, 0); + DancerP.DoScaledAnimationAsync("TurnRightDo", 0.5f); } public void RightMiss(PlayerActionEvent caller) - { + { Jukebox.PlayOneShotGame("spaceDance/inputBad2"); - DancerP.Play("Ouch", -1, 0); + DancerP.DoScaledAnimationAsync("Ouch", 0.5f); Hit.Play("HitTurn", -1, 0); - } + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + } - public void RightEmpty(PlayerActionEvent caller) + public void JustSit(PlayerActionEvent caller, float state) + { + if (state >= 1f || state <= -1f) { + Jukebox.PlayOneShotGame("spaceDance/inputBad"); + DancerP.DoScaledAnimationAsync("SitDownDo", 0.5f); + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + return; + } + SitSuccess(); + } - } - - public void SitSuccess(PlayerActionEvent caller, float state) - { + public void SitSuccess() + { Jukebox.PlayOneShotGame("spaceDance/inputGood"); - DancerP.Play("SitDownDo", -1, 0); - } + DancerP.DoScaledAnimationAsync("SitDownDo", 0.5f); + } public void SitMiss(PlayerActionEvent caller) - { + { Jukebox.PlayOneShotGame("spaceDance/inputBad2"); - DancerP.Play("Ouch", -1, 0); + DancerP.DoScaledAnimationAsync("Ouch", 0.5f); Hit.Play("HitSit", -1, 0); - } + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + } - public void SitEmpty(PlayerActionEvent caller) + public void JustPunch(PlayerActionEvent caller, float state) + { + if (state >= 1f || state <= -1f) { + Jukebox.PlayOneShotGame("spaceDance/inputBad"); + DancerP.DoScaledAnimationAsync("PunchDo", 0.5f); + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + return; + } + PunchSuccess(); + } - } - - public void PunchSuccess(PlayerActionEvent caller, float state) + public void PunchSuccess() { Jukebox.PlayOneShotGame("spaceDance/inputGood"); - DancerP.Play("PunchDo", -1, 0); + DancerP.DoScaledAnimationAsync("PunchDo", 0.5f); } public void PunchMiss(PlayerActionEvent caller) - { + { Jukebox.PlayOneShotGame("spaceDance/inputBad2"); - DancerP.Play("Ouch", -1, 0); + DancerP.DoScaledAnimationAsync("Ouch", 0.5f); Hit.Play("HitPunch", -1, 0); - } + Gramps.DoScaledAnimationAsync("GrampsOhFuck", 0.5f); + } - public void PunchEmpty(PlayerActionEvent caller) - { - - } + public void Empty(PlayerActionEvent caller) { } }