diff --git a/Assets/Resources/Games/cropStomp.prefab b/Assets/Resources/Games/cropStomp.prefab index 93ee7e47..4506f56c 100644 --- a/Assets/Resources/Games/cropStomp.prefab +++ b/Assets/Resources/Games/cropStomp.prefab @@ -891,6 +891,90 @@ MonoBehaviour: veggieTrans: {fileID: 5592378564678122777} curve: {fileID: 7648030253694337683} targetBeat: 0 +--- !u!1 &3612813939431003591 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 817633711333288879} + - component: {fileID: 6932592175373291894} + m_Layer: 0 + m_Name: veggie_0 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &817633711333288879 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3612813939431003591} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1877007400490525041} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &6932592175373291894 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3612813939431003591} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -2 + m_Sprite: {fileID: -4174758508601275437, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.49006632, y: 0.68} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &3829333311673839566 GameObject: m_ObjectHideFlags: 0 @@ -7186,9 +7270,14 @@ MonoBehaviour: collectedHolder: {fileID: 1877007400490525041} plantLeftRef: {fileID: 782346608357714935} plantRightRef: {fileID: 351003806918785885} - plantDistance: 0.1 - plantThreshold: 8 - plantLimit: 80 + plantLastRef: {fileID: 3612813939431003591} + veggieSprites: + - {fileID: -4174758508601275437, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3} + - {fileID: -2961287720435529803, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3} + - {fileID: 5598513160068558425, guid: 2deb728f30830dd438f91e9a4dff8cd4, type: 3} + startPlant: {fileID: 977280992292700036} + plantDistance: 0.2 + plantStartDistance: 0.2 --- !u!1 &8306659953435150053 GameObject: m_ObjectHideFlags: 0 @@ -7220,6 +7309,7 @@ Transform: - {fileID: 1454301511290046959} - {fileID: 5589190198322603669} - {fileID: 2126846167966614612} + - {fileID: 817633711333288879} m_Father: {fileID: 5949227026914035662} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 3.85} diff --git a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs index 03c0fdcb..d37430ea 100644 --- a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs +++ b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs @@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("clap", "Clap") { - function = delegate { ClappyTrio.instance.Clap(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, + function = delegate { ClappyTrio.instance.Clap(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity.beat); }, resizable = true }, new GameAction("bop", "Bop") @@ -84,11 +84,6 @@ namespace HeavenStudio.Games [SerializeField] private Sprite[] faces; - private bool isClapping; - private float currentClappingLength; - private float lastClapStart; - private int clapIndex; - private ClappyTrioPlayer ClappyTrioPlayer; public int misses; bool shouldBop; @@ -115,12 +110,27 @@ namespace HeavenStudio.Games InitLions(); } public override void OnGameSwitch(double beat) + { + InitClaps(beat); + } + + private void InitClaps(double beat) { RiqEntity changeLion = GameManager.instance.Beatmap.Entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat); - if(changeLion != null) + if (changeLion != null) { EventCaller.instance.CallEvent(changeLion, true); } + + var allClaps = EventCaller.GetAllInGameManagerList("clappyTrio", new string[] { "clap" }); + + foreach (var c in allClaps) + { + if (c.beat < beat && c.beat + (c.length * (lionCount - 1)) >= beat) + { + Clap(c.beat, c.length, beat); + } + } } void Update() @@ -181,24 +191,32 @@ namespace HeavenStudio.Games clapAction.Delete(); } - public void Clap(double beat, float length) + public void Clap(double beat, float length, double gameSwitchBeat) { ClappyTrioPlayer.clapStarted = true; ClappyTrioPlayer.canHit = true; // this is technically a lie, this just restores the ability to hit - - isClapping = true; // makes the other lions clap List sounds = new List(); List actions = new List(); for (int i = 0; i < Lion.Count - 1; i++) { + bool isBeforeGameSwitch = beat + (length * i) < gameSwitchBeat; int idx = i; - sounds.Add(new MultiSound.Sound((i > 0) ? "clappyTrio/middleClap" : "clappyTrio/leftClap", beat + (length * i))); - actions.Add(new BeatAction.Action(beat + (length * i), delegate { SetFace(idx, 4); Lion[idx].GetComponent().Play("Clap", 0, 0);})); + if (isBeforeGameSwitch) + { + SetFace(idx, 4); + Lion[idx].GetComponent().Play("Clap", 0, 1); + } + else + { + sounds.Add(new MultiSound.Sound((i > 0) ? "clappyTrio/middleClap" : "clappyTrio/leftClap", beat + (length * i))); + actions.Add(new BeatAction.Action(beat + (length * i), delegate + { SetFace(idx, 4); Lion[idx].GetComponent().Play("Clap", 0, 0); })); + } } - clapSounds = MultiSound.Play(sounds.ToArray()); - clapAction = BeatAction.New(this.gameObject, actions); + if (sounds.Count > 0) clapSounds = MultiSound.Play(sounds.ToArray()); + if (actions.Count > 0) clapAction = BeatAction.New(this.gameObject, actions); // prepare player input ClappyTrioPlayer.QueueClap(beat, length * (Lion.Count - 1)); diff --git a/Assets/Scripts/Games/CropStomp/CropStomp.cs b/Assets/Scripts/Games/CropStomp/CropStomp.cs index 1653ea7c..36eeebfc 100644 --- a/Assets/Scripts/Games/CropStomp/CropStomp.cs +++ b/Assets/Scripts/Games/CropStomp/CropStomp.cs @@ -27,20 +27,36 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("mole", "Mole") { + preFunction = delegate + { + if (eventCaller.currentEntity["mute"]) return; + CropStomp.MoleSound(eventCaller.currentEntity.beat); + }, defaultLength = 2f, parameters = new List() { new Param("mute", false, "Mute", "Should the mole laugh sound be muted?") + }, + preFunctionLength = 6 + }, + new GameAction("end", "End") + { + parameters = new List() + { + new Param("mute", true, "Mute Humming?") } }, new GameAction("plantCollect", "Veggie Collection Values") { - function = delegate { var e = eventCaller.currentEntity; CropStomp.instance.SetCollectThresholds(e["threshold"], e["limit"]); }, + function = delegate { var e = eventCaller.currentEntity; + CropStomp.instance.SetCollectThresholds(e["threshold"], e["limit"], e["force"], e["forceAmount"]); }, defaultLength = 0.5f, parameters = new List() { new Param("threshold", new EntityTypes.Integer(1, 80, 8), "Threshold", "For each time the threshold is met a new plant will appear in the veggie bag."), - new Param("limit", new EntityTypes.Integer(1, 1000, 80), "Limit", "What is the limit for plants collected?") + new Param("limit", new EntityTypes.Integer(1, 1000, 80), "Limit", "What is the limit for plants collected?"), + new Param("force", false, "Force Amount of Collected Plants"), + new Param("forceAmount", new EntityTypes.Integer(0, 1000, 0), "Force Amount") } } }, @@ -59,7 +75,7 @@ namespace HeavenStudio.Games public class CropStomp : Minigame { const float stepDistance = 2.115f; - public static float[] moleSoundOffsets = new float[]{ 0.134f, 0.05f, 0.061f }; + //public static float[] moleSoundOffsets = new float[]{ 0.134f, 0.05f, 0.061f }; float scrollRate => stepDistance / (Conductor.instance.pitchedSecPerBeat * 2f); float grassWidth; @@ -67,6 +83,8 @@ namespace HeavenStudio.Games private double newBeat = -1f; // So that marching can happen on beat 0. private double marchStartBeat = -1f; + private double marchEndBeat = double.MaxValue; + private bool willNotHum = true; private double marchOffset; private int currentMarchBeat; private int stepCount; @@ -171,7 +189,7 @@ namespace HeavenStudio.Games //get the beat of the closest end event foreach (var end in allEnds) { - if (end.datamodel.Split(2) == "cropStomp") continue; + if (end.datamodel != "gameManager/end" && end.datamodel.Split(2) == "cropStomp") continue; if (end.beat > startBeat) { endBeat = end.beat; @@ -219,6 +237,43 @@ namespace HeavenStudio.Games } List cuedMoleSounds = new List(); + + public override void OnGameSwitch(double beat) + { + SetInitTresholds(beat); + SetMarchEndBeat(beat); + } + + public override void OnPlay(double beat) + { + SetInitTresholds(beat); + SetMarchEndBeat(beat); + } + + private void SetMarchEndBeat(double beat) + { + double nextEndBeat = double.MaxValue; + var nextEnd = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }).Find(e => e.beat > beat); + if (nextEnd != null) nextEndBeat = nextEnd.beat; + + var allEnds = EventCaller.GetAllInGameManagerList("cropStomp", new string[] { "end" }); + var tempEnds = allEnds.FindAll(x => x.beat >= beat && x.beat < nextEndBeat); + if (tempEnds.Count == 0) return; + + marchEndBeat = tempEnds[0].beat; + willNotHum = tempEnds[0]["mute"]; + } + + public static void MoleSound(double beat) + { + MultiSound.Play(new MultiSound.Sound[] + { + new MultiSound.Sound("cropStomp/moleNyeh", beat - 2, 1, 1, false, 0.134), + new MultiSound.Sound("cropStomp/moleHeh1", beat - 1.5, 1, 1, false, 0.05), + new MultiSound.Sound("cropStomp/moleHeh2", beat - 1, 1, 1, false, 0.061) + }, forcePlay: true); + } + private void Update() { var cond = Conductor.instance; @@ -226,37 +281,26 @@ namespace HeavenStudio.Games if (!cond.isPlaying) return; - // Mole sounds. - var moleEvents = GameManager.instance.Beatmap.Entities.FindAll(m => m.datamodel == "cropStomp/mole"); - for (int i = 0; i < moleEvents.Count; i++) - { - var moleEvent = moleEvents[i]; - if (moleEvent["mute"]) continue; - var timeToEvent = moleEvent.beat - cond.songPositionInBeatsAsDouble; - if (timeToEvent <= 4f && timeToEvent > 2f && !cuedMoleSounds.Contains(moleEvent)) - { - cuedMoleSounds.Add(moleEvent); - MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("cropStomp/moleNyeh", (moleEvent.beat - 2f) - moleSoundOffsets[0] * Conductor.instance.songBpm / 60f), - new MultiSound.Sound("cropStomp/moleHeh1", (moleEvent.beat - 1.5f) - moleSoundOffsets[1] * Conductor.instance.songBpm / 60f), - new MultiSound.Sound("cropStomp/moleHeh2", (moleEvent.beat - 1f) - moleSoundOffsets[2] * Conductor.instance.songBpm / 60f) }); - } - } - if (!isMarching) return; // Debug.Log(newBeat); + bool cameraLocked = cond.songPositionInBeats >= marchEndBeat; + bool isHumming = !(cameraLocked && willNotHum); + if (cond.ReportBeat(ref newBeat, marchOffset, true)) { currentMarchBeat += 1; PlayAnims(); - if (currentMarchBeat % 2 != 0) //step sound + if (currentMarchBeat % 2 != 0 && isHumming) //step sound { MultiSound.Play(new MultiSound.Sound[] {new MultiSound.Sound("cropStomp/hmm", newBeat + marchOffset)}); } } + if (cameraLocked) return; + // Object scroll. var scrollPos = scrollingHolder.localPosition; var newScrollX = scrollPos.x + (scrollRate * Time.deltaTime); @@ -294,16 +338,27 @@ namespace HeavenStudio.Games isFlicking = false; } - public void SetCollectThresholds(int thresholdEvolve, int limit) + public void SetCollectThresholds(int thresholdEvolve, int limit, bool force, int forceAmount) { farmer.plantThreshold = thresholdEvolve; farmer.plantLimit = limit; + if (force) Farmer.collectedPlants = forceAmount; farmer.UpdatePlants(); } - public void CollectPlant() + private void SetInitTresholds(double beat) { - farmer.CollectPlant(); + var allCollects = EventCaller.GetAllInGameManagerList("cropStomp", new string[] { "plantCollect" }); + if (allCollects.Count == 0) return; + + var tempCollect = allCollects.FindLast(x => x.beat < beat); + if (tempCollect == null) return; + SetCollectThresholds(tempCollect["threshold"], tempCollect["limit"], tempCollect["force"], tempCollect["forceAmount"]); + } + + public void CollectPlant(int veggieType) + { + farmer.CollectPlant(veggieType); } private void PlayAnims() diff --git a/Assets/Scripts/Games/CropStomp/Farmer.cs b/Assets/Scripts/Games/CropStomp/Farmer.cs index 7dfc89ea..9821588a 100644 --- a/Assets/Scripts/Games/CropStomp/Farmer.cs +++ b/Assets/Scripts/Games/CropStomp/Farmer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using System; namespace HeavenStudio.Games.Scripts_CropStomp { @@ -18,15 +19,20 @@ namespace HeavenStudio.Games.Scripts_CropStomp [SerializeField] private GameObject plantLeftRef; [SerializeField] private GameObject plantRightRef; + [SerializeField] private GameObject plantLastRef; + [SerializeField] private Sprite[] veggieSprites; + [SerializeField] private GameObject startPlant; private List spawnedPlants = new List(); + private int lastVeggieType; [SerializeField] private float plantDistance = 0.5f; + [SerializeField] private float plantStartDistance = 0.1f; - public int plantThreshold = 8; + [NonSerialized] public int plantThreshold = 8; - public int plantLimit = 80; + [NonSerialized] public int plantLimit = 80; - private static int collectedPlants = 0; + public static int collectedPlants = 0; private void OnDestroy() { @@ -68,15 +74,17 @@ namespace HeavenStudio.Games.Scripts_CropStomp } } - public void CollectPlant() + public void CollectPlant(int veggieType) { - if (collectedPlants >= plantLimit) return; + if (collectedPlants > plantLimit) return; + if (collectedPlants <= plantLimit - plantThreshold) lastVeggieType = veggieType; collectedPlants++; UpdatePlants(); } public void UpdatePlants() { + startPlant.SetActive(collectedPlants >= plantThreshold); if (spawnedPlants.Count > 0) { foreach (var plant in spawnedPlants) @@ -85,11 +93,19 @@ namespace HeavenStudio.Games.Scripts_CropStomp } spawnedPlants.Clear(); } - for (int i = 0; i < collectedPlants && i < plantLimit; i += plantThreshold) + for (int i = 0; i <= collectedPlants - (plantThreshold * 2) && i <= plantLimit - (plantThreshold * 2); i += plantThreshold) { - GameObject spawnedPlant = Instantiate(((i / plantThreshold) % 2 == 0) ? plantRightRef : plantLeftRef, collectedHolder); - spawnedPlant.transform.localPosition = new Vector3(0, (i / plantThreshold) * plantDistance + plantDistance, 0); - spawnedPlant.GetComponent().sortingOrder = (i / plantThreshold) - 2; + bool isLast = i == plantLimit - (plantThreshold * 2); + int realIndex = i / plantThreshold; + GameObject spawnedPlant; + if (isLast) + { + spawnedPlant = Instantiate(plantLastRef, collectedHolder); + spawnedPlant.GetComponent().sprite = veggieSprites[lastVeggieType]; + } + else spawnedPlant = Instantiate((realIndex % 2 == 0) ? plantRightRef : plantLeftRef, collectedHolder); + spawnedPlant.transform.localPosition = new Vector3(0, (realIndex * plantDistance) + plantStartDistance, 0); + spawnedPlant.GetComponent().sortingOrder = -realIndex - 2; spawnedPlant.SetActive(true); spawnedPlants.Add(spawnedPlant); } @@ -101,7 +117,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp Stomp(state >= 1f || state <= -1f); } - private void Miss(PlayerActionEvent caller) + private void Miss(PlayerActionEvent caller) { if (GameManager.instance.currentGame != "cropStomp") return; if (!game.isMarching) diff --git a/Assets/Scripts/Games/CropStomp/Veggie.cs b/Assets/Scripts/Games/CropStomp/Veggie.cs index 67902e6c..306a2ce3 100644 --- a/Assets/Scripts/Games/CropStomp/Veggie.cs +++ b/Assets/Scripts/Games/CropStomp/Veggie.cs @@ -27,6 +27,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp private int veggieState = 0; private bool boinked; // Player got barely when trying to pick. private bool pickEligible = true; + private int veggieType; private double landBeat; @@ -43,7 +44,8 @@ namespace HeavenStudio.Games.Scripts_CropStomp if (!isMole) { - veggieSprite.sprite = veggieSprites[UnityEngine.Random.Range(0, veggieSprites.Length)]; + veggieType = UnityEngine.Random.Range(0, veggieSprites.Length); + veggieSprite.sprite = veggieSprites[veggieType]; } else { @@ -206,7 +208,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp veggieTrans.localScale = Vector2.one * veggieScale; if (pickPosition >= 1f) { - game.CollectPlant(); + game.CollectPlant(veggieType); } } } diff --git a/Assets/Scripts/Games/Lockstep/Lockstep.cs b/Assets/Scripts/Games/Lockstep/Lockstep.cs index 611cbac8..fedac00e 100644 --- a/Assets/Scripts/Games/Lockstep/Lockstep.cs +++ b/Assets/Scripts/Games/Lockstep/Lockstep.cs @@ -257,15 +257,15 @@ namespace HeavenStudio.Games var switchEventsOn = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "onbeatSwitch" }); foreach (var on in switchEventsOn) { - if (on.beat >= nextGameSwitchBeat || !on["visual"]) return; - OnbeatSwitch(on.beat, beat); + if (on.beat >= nextGameSwitchBeat) continue; + OnbeatSwitch(on.beat, beat, on["visual"]); } var switchEventsOff = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "offbeatSwitch" }); foreach (var off in switchEventsOff) { - if (off.beat >= nextGameSwitchBeat || !off["visual"]) return; - OffbeatSwitch(off.beat, beat); + if (off.beat >= nextGameSwitchBeat) continue; + OffbeatSwitch(off.beat, beat, off["visual"]); } } @@ -429,22 +429,22 @@ namespace HeavenStudio.Games } } - private void OnbeatSwitch(double beat, double gameswitchBeat) + private void OnbeatSwitch(double beat, double gameswitchBeat, bool visual) { List allActions = new List() { - new BeatAction.Action(beat, delegate { ChangeBeatBackGroundColour(false); }), - new BeatAction.Action(beat + 0.5f, delegate { ChangeBeatBackGroundColour(true); }), + new BeatAction.Action(beat, delegate { if(visual) ChangeBeatBackGroundColour(false); }), + new BeatAction.Action(beat + 0.5f, delegate { if (visual) ChangeBeatBackGroundColour(true); }), new BeatAction.Action(beat + 1f, delegate { - ChangeBeatBackGroundColour(false); + if(visual) ChangeBeatBackGroundColour(false); }), new BeatAction.Action(beat + 1.5f, delegate - { - ChangeBeatBackGroundColour(true); + { + if (visual) ChangeBeatBackGroundColour(true); }), new BeatAction.Action(beat + 1.75f, delegate { if (!marchRecursing) MarchRecursive(beat + 2f); }), - new BeatAction.Action(beat + 2f, delegate { ChangeBeatBackGroundColour(false); }), + new BeatAction.Action(beat + 2f, delegate { if (visual) ChangeBeatBackGroundColour(false); }), }; List actions = new(); foreach (var action in allActions) @@ -495,19 +495,19 @@ namespace HeavenStudio.Games } } - private void OffbeatSwitch(double beat, double gameswitchBeat) + private void OffbeatSwitch(double beat, double gameswitchBeat, bool visual) { List allActions = new List() { - new BeatAction.Action(beat, delegate { ChangeBeatBackGroundColour(true); }), - new BeatAction.Action(beat + 1f, delegate { ChangeBeatBackGroundColour(false); }), - new BeatAction.Action(beat + 2f, delegate { ChangeBeatBackGroundColour(true); }), + new BeatAction.Action(beat, delegate { if (visual) ChangeBeatBackGroundColour(true); }), + new BeatAction.Action(beat + 1f, delegate { if (visual) ChangeBeatBackGroundColour(false); }), + new BeatAction.Action(beat + 2f, delegate { if (visual) ChangeBeatBackGroundColour(true); }), new BeatAction.Action(beat + 3f, delegate { - ChangeBeatBackGroundColour(false); + if (visual) ChangeBeatBackGroundColour(false); }), new BeatAction.Action(beat + 3.25f, delegate { if (!marchRecursing) MarchRecursive(beat + 3.5f); }), - new BeatAction.Action(beat + 3.5f, delegate { ChangeBeatBackGroundColour(true); }), + new BeatAction.Action(beat + 3.5f, delegate { if (visual) ChangeBeatBackGroundColour(true); }), }; List actions = new(); foreach (var action in allActions) diff --git a/Assets/Scripts/Games/Ringside/Ringside.cs b/Assets/Scripts/Games/Ringside/Ringside.cs index bf1a6986..0d7cfe60 100644 --- a/Assets/Scripts/Games/Ringside/Ringside.cs +++ b/Assets/Scripts/Games/Ringside/Ringside.cs @@ -148,6 +148,7 @@ namespace HeavenStudio.Games private bool hitPose; private bool shouldNotInput; private bool keepZoomOut; + private bool canBop = true; private Sound kidsLaugh; private int currentPose; private Util.EasingFunction.Ease lastEase; @@ -204,7 +205,7 @@ namespace HeavenStudio.Games { if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) { - if (wrestlerAnim.IsAnimationNotPlaying() && shouldBop) + if (shouldBop && canBop) { if (UnityEngine.Random.Range(1, 18) == 1) { @@ -394,6 +395,8 @@ namespace HeavenStudio.Games BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + 0.5f, delegate { reporterAnim.DoScaledAnimationAsync("ThatTrue", 0.5f); }), + new BeatAction.Action(beat + 1.5f, delegate { canBop = false; }), + new BeatAction.Action(beat + 2.5f, delegate { canBop = true; }) }); } @@ -418,6 +421,8 @@ namespace HeavenStudio.Games BeatAction.New(instance.gameObject, new List() { new BeatAction.Action(beat + 2f, delegate { reporterAnim.Play("True", 0, 0); }), + new BeatAction.Action(beat + 2.25f, delegate { canBop = false; }), + new BeatAction.Action(beat + 3.5f, delegate { canBop = true; }) }); } @@ -461,14 +466,31 @@ namespace HeavenStudio.Games } BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(beat, delegate {audienceAnim.DoScaledAnimationAsync("PoseAudience", 0.25f); }), - new BeatAction.Action(beat, delegate {wrestlerAnim.DoScaledAnimationAsync("PreparePose", 0.25f); }), - new BeatAction.Action(beat, delegate {shouldBop = false; }), + new BeatAction.Action(beat, delegate + { + audienceAnim.DoScaledAnimationAsync("PoseAudience", 0.25f); + wrestlerAnim.DoScaledAnimationAsync("PreparePose", 0.25f); + canBop = false; + }), new BeatAction.Action(beat + 1, delegate { PoseCheck(beat); }), - new BeatAction.Action(beat + 3.99f, delegate { wrestlerAnim.Play("Idle", 0, 1); }), - new BeatAction.Action(beat + 3.99f, delegate { reporterAnim.DoUnscaledAnimation("IdleReporter"); }), - new BeatAction.Action(beat + 3.99f, delegate { shouldNotInput = false; }), - new BeatAction.Action(beat + 3.99f, delegate { shouldBop = true; }), + new BeatAction.Action(beat + 4f, delegate + { + if (shouldBop) + { + if (UnityEngine.Random.Range(1, 18) == 1) + { + wrestlerAnim.DoScaledAnimationAsync("BopPec"); + } + else + { + wrestlerAnim.DoScaledAnimationAsync("Bop"); + } + } + else wrestlerAnim.Play("Idle", 0, 1); + reporterAnim.DoUnscaledAnimation("IdleReporter"); + shouldNotInput = false; + canBop = true; + }), }); if (!keepZoomedOut) { @@ -730,27 +752,6 @@ namespace HeavenStudio.Games new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }), }); } - BeatAction.New(instance.gameObject, new List() - { - new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate - { - if (shouldBop) - { - if (UnityEngine.Random.Range(1, 18) == 1) - { - wrestlerAnim.DoScaledAnimationAsync("BopPec"); - } - else - { - wrestlerAnim.DoScaledAnimationAsync("Bop"); - } - } - else - { - wrestlerAnim.Play("Idle", 0, 1); - } - }), - }); return; } SuccessBigGuySecond(caller); @@ -782,28 +783,6 @@ namespace HeavenStudio.Games new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }), }); } - BeatAction.New(instance.gameObject, new List() - { - new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate - { - if (shouldBop) - { - if (UnityEngine.Random.Range(1, 18) == 1) - { - wrestlerAnim.DoScaledAnimationAsync("BopPec"); - } - else - { - wrestlerAnim.DoScaledAnimationAsync("Bop"); - } - } - else - { - wrestlerAnim.Play("Idle", 0, 1); - } - }), - }); - } public void JustPoseForTheFans(PlayerActionEvent caller, float state) diff --git a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs index 05373567..6f3ee20f 100644 --- a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs +++ b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs @@ -59,13 +59,6 @@ namespace HeavenStudio.Games using Scripts_SneakySpirits; public class SneakySpirits : Minigame { - public struct QueuedGhost - { - public double beat; - public float length; - public bool slowDown; - public List volumes; - } [Header("Components")] [SerializeField] Animator bowAnim; [SerializeField] Animator bowHolderAnim; @@ -79,8 +72,7 @@ namespace HeavenStudio.Games [SerializeField] GameObject slowRain; [SerializeField] GameObject normalTree; [SerializeField] GameObject slowTree; - [Header("Variables")] - private static List queuedGhosts = new List(); + private bool hasArrowLoaded; float movingLength; double movingStartBeat; @@ -92,7 +84,6 @@ namespace HeavenStudio.Games void OnDestroy() { - if (queuedGhosts.Count > 0) queuedGhosts.Clear(); Conductor.instance.SetMinigamePitch(1f); foreach (var evt in scheduledInputs) { @@ -100,6 +91,28 @@ namespace HeavenStudio.Games } } + public override void OnGameSwitch(double beat) + { + InitGhosts(beat); + } + + private void InitGhosts(double beat) + { + var allGhosts = EventCaller.GetAllInGameManagerList("sneakySpirits", new string[] { "spawnGhost" }); + + foreach (var ghost in allGhosts) + { + if (ghost.beat < beat && ghost.beat + (ghost.length * 7) >= beat) + { + SpawnGhost(ghost.beat, beat, ghost.length, ghost["slowDown"], new List() + { + ghost["volume1"], ghost["volume2"], ghost["volume3"], ghost["volume4"], ghost["volume5"], ghost["volume6"], + ghost["volume7"], + }); + } + } + } + void Awake() { instance = this; @@ -111,14 +124,6 @@ namespace HeavenStudio.Games var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (queuedGhosts.Count > 0) - { - foreach(var ghost in queuedGhosts) - { - SpawnGhost(ghost.beat, ghost.length, ghost.slowDown, ghost.volumes); - } - queuedGhosts.Clear(); - } if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN) && hasArrowLoaded) { WhiffArrow(cond.songPositionInBeatsAsDouble); @@ -137,7 +142,6 @@ namespace HeavenStudio.Games } else if (!cond.isPlaying) { - queuedGhosts.Clear(); Conductor.instance.SetMinigamePitch(1f); } } @@ -172,27 +176,14 @@ namespace HeavenStudio.Games }, forcePlay: true); if (GameManager.instance.currentGame == "sneakySpirits") { - SneakySpirits.instance.SpawnGhost(beat, length, slowDown, new List() + SneakySpirits.instance.SpawnGhost(beat, beat, length, slowDown, new List() { volume1, volume2, volume3, volume4, volume5, volume6, volume7 }); } - else - { - queuedGhosts.Add(new QueuedGhost - { - beat = beat, - length = length, - volumes = new List() - { - volume1, volume2, volume3, volume4, volume5, volume6, volume7 - }, - slowDown = slowDown, - }); - } } - public void SpawnGhost(double beat, float length, bool slowDown, List volumes) + public void SpawnGhost(double beat, double gameSwitchBeat, float length, bool slowDown, List volumes) { if (slowDown) { @@ -211,7 +202,7 @@ namespace HeavenStudio.Games for(int i = 0; i < 7; i++) { double spawnBeat = beat + length * i; - if (spawnBeat >= Conductor.instance.songPositionInBeatsAsDouble) + if (spawnBeat >= gameSwitchBeat) { SneakySpiritsGhost spawnedGhost = Instantiate(movingGhostPrefab, ghostPositions[i], false); spawnedGhost.transform.position = new Vector3(spawnedGhost.transform.position.x, spawnedGhost.transform.position.y - (1 - volumes[i] * 0.01f) * 2.5f, spawnedGhost.transform.position.z); diff --git a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs index e74e2ba2..f5a92d49 100644 --- a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs +++ b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs @@ -402,7 +402,7 @@ namespace HeavenStudio.Games break; } - MultiSound.Play(soundsToPlay.ToArray()); + MultiSound.Play(soundsToPlay.ToArray(), true, true); } public void DoTurnRight(double beat, bool grampsTurns) @@ -471,7 +471,7 @@ namespace HeavenStudio.Games break; } - MultiSound.Play(soundsToPlay.ToArray()); + MultiSound.Play(soundsToPlay.ToArray(), true, true); } public void DoSitDown(double beat, bool grampsSits) @@ -546,7 +546,7 @@ namespace HeavenStudio.Games break; } - MultiSound.Play(soundsToPlay.ToArray()); + MultiSound.Play(soundsToPlay.ToArray(), true, true); } public void DoPunch(double beat, bool grampsPunches) diff --git a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs index bac983ef..bf1520e9 100644 --- a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs +++ b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs @@ -319,7 +319,9 @@ namespace HeavenStudio.Games { continue; } - Dispense(entity.beat, false); + bool isOnGameSwitchBeat = entity.beat == beat; + Debug.Log(isOnGameSwitchBeat); + Dispense(entity.beat, isOnGameSwitchBeat && !entity["toggle"], false, isOnGameSwitchBeat && entity["down"]); break; } } @@ -449,9 +451,8 @@ namespace HeavenStudio.Games for (int i = 0; i < kickers.Count; i++) { Kicker kicker = kickers[i]; - if (i == 0) kicker.player = true; - - if (kicker.ball != null || (ignorePlayer && i == 0)) continue; + kicker.player = i == 0; + if (kicker.ball != null || (ignorePlayer && kicker.player)) continue; GameObject ball = Instantiate(ballRef, kicker.transform.GetChild(0)); ball.SetActive(true); diff --git a/Assets/Scripts/Games/TapTrial/TapTrial.cs b/Assets/Scripts/Games/TapTrial/TapTrial.cs index 9e674315..56aa572d 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrial.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrial.cs @@ -267,6 +267,11 @@ namespace HeavenStudio.Games player.Bop(); } + private bool IsEventAtBeat(double beat, double endBeat) + { + return EventCaller.GetAllInGameManagerList("tapTrial", new string[] { "tap", "double tap", "triple tap", "jump tap" }).Find(x => x.beat >= beat && x.beat < endBeat) != null; + } + public void Tap(double beat) { canBop = false; @@ -284,7 +289,7 @@ namespace HeavenStudio.Games }), new BeatAction.Action(beat + 1.5, delegate { - canBop = true; + if (!IsEventAtBeat(beat + 1, beat + 2)) canBop = true; }) }); @@ -320,7 +325,7 @@ namespace HeavenStudio.Games { PlayMonkeyAnimationScaledAsync("DoubleTap", 0.5f); MonkeyParticles(false); - canBop = true; + if (!IsEventAtBeat(beat + 1, beat + 2)) canBop = true; }), }); @@ -407,7 +412,7 @@ namespace HeavenStudio.Games }), new BeatAction.Action(beat + 1.5, delegate { - canBop = final; + if (!IsEventAtBeat(beat + 1, beat + 2)) canBop = final; }) });