diff --git a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs index 98019ade..2392ed03 100644 --- a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs +++ b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs @@ -159,7 +159,8 @@ namespace HeavenStudio.Games { public int expression; public double beat; - public Reaction(int expression, double beat) { + public Reaction(int expression, double beat) + { this.expression = expression; this.beat = beat; } @@ -177,7 +178,7 @@ namespace HeavenStudio.Games public Animator TackAnim; [SerializeField] Animator CartGuyParentAnim; [SerializeField] Animator CartGuyAnim; - + [Header("Variables")] private bool bossBop = true; public bool bossAnnoyed = false; @@ -260,7 +261,7 @@ namespace HeavenStudio.Games float normalizedBeat = cond.GetPositionFromBeat(gearEase.beat, gearEase.length); Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(gearEase.ease); currentGearSpeed = func(oldGearSpeed, newGearSpeed, normalizedBeat); - if (normalizedBeat >= 1) cartEase.length = 0; + if (normalizedBeat >= 1) gearEase.length = 0; } if (cartEase.length != 0) @@ -268,24 +269,32 @@ namespace HeavenStudio.Games float normalizedBeat = cond.GetPositionFromBeat(cartEase.beat, cartEase.length); Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(cartEase.ease); float newPos = func(0f, 1f, normalizedBeat); + Debug.Log($"{normalizedBeat}, {newPos}"); CartGuyParentAnim.DoNormalizedAnimation($"Move{cartDir}", newPos); if (normalizedBeat >= 1) cartEase.length = 0; } CartGuyParentAnim.gameObject.SetActive(cartEase.length != 0); - if (cond.isPlaying && !cond.isPaused) { - foreach (Transform gear in Gears) { + if (cond.isPlaying && !cond.isPaused) + { + foreach (Transform gear in Gears) + { double newZ = Time.deltaTime * currentGearSpeed * 50 * (gear.name == "Big" ? -1 : 1) / cond.pitchedSecPerBeat; gear.Rotate(new Vector3(0, 0, (float)newZ)); } } - - if (cond.isPlaying) { + + if (cond.isPlaying) + { MeatSplash.Play(); - } else if (cond.isPaused) { + } + else if (cond.isPaused) + { MeatSplash.Pause(); - } else { + } + else + { MeatSplash.Stop(); } } @@ -297,11 +306,15 @@ namespace HeavenStudio.Games BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f); } - if (CartGuyParentAnim.gameObject.activeSelf) { + if (CartGuyParentAnim.gameObject.activeSelf) + { // Debug.Log(cartPhone ? "PhoneBop" : "Bop"); - if (cartPhone) { + if (cartPhone) + { CartGuyAnim.DoScaledAnimationAsync("PhoneBop", 0.5f); - } else { + } + else + { CartGuyAnim.DoScaledAnimationAsync("Bop", 0.5f); } } @@ -326,15 +339,18 @@ namespace HeavenStudio.Games { List allEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == "meatGrinder"); RiqEntity cg = allEntities.Find(c => c.datamodel == "meatGrinder/cartGuy"); - if (cg != null) { + if (cg != null) + { CartGuy(cg.beat, cg.length, cg["spider"], cg["direction"], cg["ease"]); } RiqEntity gr = allEntities.Find(c => c.datamodel == "meatGrinder/gears"); - if (gr != null) { + if (gr != null) + { ChangeGears(gr.beat, gr.length, gr["ease"], gr["speed"]); } List meats = allEntities.FindAll(c => c.datamodel == "meatGrinder/MeatToss" && beat > c.beat && beat < c.beat + 1); - foreach (var meat in meats) { + foreach (var meat in meats) + { MeatToss(meat.beat, meat["bacon"], meat["tackReaction"], meat["tackReactionBeats"], meat["bossReaction"], meat["bossReactionBeats"]); } } @@ -352,8 +368,10 @@ namespace HeavenStudio.Games var actions = new List(); for (int i = 0; i < length; i++) { - actions.Add(new BeatAction.Action(beat + i, delegate { - if (!BossAnim.IsPlayingAnimationNames("BossCall", "BossSignal")) { + actions.Add(new BeatAction.Action(beat + i, delegate + { + if (!BossAnim.IsPlayingAnimationNames("BossCall", "BossSignal")) + { BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f); } })); @@ -364,11 +382,13 @@ namespace HeavenStudio.Games public void DoExpressions(int tackExpression, int bossExpression = 0) { - if (tackExpression != (int)TackExpressions.None) { + if (tackExpression != (int)TackExpressions.None) + { string tackAnim = ((TackExpressions)tackExpression).ToString(); TackAnim.DoScaledAnimationAsync("Tack" + tackAnim, 0.5f); } - if (bossExpression != (int)BossExpressions.None) { + if (bossExpression != (int)BossExpressions.None) + { string bossAnim = ((BossExpressions)bossExpression).ToString(); BossAnim.DoScaledAnimationAsync("Boss" + bossAnim, 0.5f); } @@ -376,21 +396,24 @@ namespace HeavenStudio.Games public void CartGuy(double beat, float length, bool spider, int direction, int ease) { - cartEase = new() { + cartPhone = spider; + cartDir = direction == 0 ? "Right" : "Left"; + if (cartPhone) + { + CartGuyAnim.Play("Phone", 0, 0); + } + cartEase = new() + { beat = beat, length = length, ease = (Util.EasingFunction.Ease)ease, }; - cartPhone = spider; - cartDir = direction == 0 ? "Right" : "Left"; - if (cartPhone) { - CartGuyAnim.Play("Phone", 0, 0); - } } public void ChangeGears(double beat, float length, int ease, float speed) { - gearEase = new() { + gearEase = new() + { beat = beat, length = length, ease = (Util.EasingFunction.Ease)ease, @@ -487,7 +510,8 @@ namespace HeavenStudio.Games private void PassTurn(double beat, double intervalBeat, float intervalLength, List allCallEvents = null) { - if (allCallEvents == null) { + if (allCallEvents == null) + { allCallEvents = GetRelevantMeatCallsBetweenBeat(intervalBeat, intervalBeat + intervalLength); allCallEvents.Sort((x, y) => x.beat.CompareTo(y.beat)); } diff --git a/Assets/Scripts/JudgementManager.cs b/Assets/Scripts/JudgementManager.cs index 2b1a080d..0bf93344 100644 --- a/Assets/Scripts/JudgementManager.cs +++ b/Assets/Scripts/JudgementManager.cs @@ -260,13 +260,6 @@ namespace HeavenStudio } break; } - - epilogueFrame.sprite = rank switch - { - Rank.Ok => epilogueFrmOk, - Rank.Hi => epilogueFrmHi, - _ => epilogueFrmNg - }; } header.text = playedBeatmap != null ? playedBeatmap["resultcaption"] : "Rhythm League Notes"; @@ -303,6 +296,13 @@ namespace HeavenStudio imageResource = playedBeatmap != null ? playedBeatmap["epilogue_hi_res"] : null; } + epilogueFrame.sprite = rank switch + { + Rank.Ok => epilogueFrmOk, + Rank.Hi => epilogueFrmHi, + _ => epilogueFrmNg + }; + if (imageResource != null) { imagePath = imageResource.Value.path;