From 849234931f685cf0758a9e564ce10f8187b4ac73 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:04:24 +0100 Subject: [PATCH] accomadation for persist/stretch --- .../Scripts/Games/LumBEARjack/LBJBigObject.cs | 10 +++- .../Games/LumBEARjack/LBJHugeObject.cs | 56 +++++++++++++------ .../Games/LumBEARjack/LBJSmallObject.cs | 4 +- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs b/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs index 8babab94d..63fddb808 100644 --- a/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs +++ b/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs @@ -21,6 +21,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack private PlayerActionEvent _cutActionEvent; private double _rotationBeat; + private double _rotationLength; public void Init(LBJBear bear, double beat, double length, LumBEARjack.BigType type, double startUpBeat = -1) { @@ -28,15 +29,20 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack _type = type; _rotationBeat = beat + (length / 4 * 2); + _rotationLength = length / 4; if (startUpBeat <= beat + (length / 4 * 2)) LumBEARjack.instance.ScheduleInput(beat, length / 4 * 2, Minigame.InputAction_BasicPress, JustHit, Miss, Blank); - else _rotationBeat = beat + (length / 4 * 3); + else + { + _rotationBeat = beat + (length / 4 * 3); + _logSR.sprite = _logCutSprite; + } _cutActionEvent = LumBEARjack.instance.ScheduleInput(beat, length / 4 * 3, Minigame.InputAction_BasicPress, JustCut, Miss, Blank); Update(); } private void Update() { - float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - 1, 2); + float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - _rotationLength, _rotationLength * 2); var func = EasingFunction.GetEasingFunction(_ease); diff --git a/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs b/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs index 644f97e77..4ec362fb3 100644 --- a/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs +++ b/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs @@ -25,6 +25,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3]; private double _rotationBeat; + private double _rotationLength; private void Awake() { @@ -54,14 +55,28 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack } _rotationBeat = beat + (length / 6 * 2); + _rotationLength = length / 6; + if (startUpBeat <= beat + (length / 6 * 2)) LumBEARjack.instance.ScheduleInput(beat, length / 6 * 2, Minigame.InputAction_BasicPress, JustHit1, Miss, Blank); - else _rotationBeat = beat + (length / 6 * 3); + else + { + _rotationBeat = beat + (length / 6 * 3); + SetObjectCutSprite(1); + } if (startUpBeat <= beat + (length / 6 * 3)) _soundsToDeleteIfMiss[0] = LumBEARjack.instance.ScheduleInput(beat, length / 6 * 3, Minigame.InputAction_BasicPress, JustHit2, Miss, Blank); - else _rotationBeat = beat + (length / 6 * 4); + else + { + _rotationBeat = beat + (length / 6 * 4); + SetObjectCutSprite(2); + } if (startUpBeat <= beat + (length / 6 * 4)) _soundsToDeleteIfMiss[1] = LumBEARjack.instance.ScheduleInput(beat, length / 6 * 4, Minigame.InputAction_BasicPress, JustHit3, Miss, Blank); - else _rotationBeat = beat + (length / 6 * 5); + else + { + _rotationBeat = beat + (length / 6 * 5); + SetObjectCutSprite(3); + } _soundsToDeleteIfMiss[2] = LumBEARjack.instance.ScheduleInput(beat, length / 6 * 5, Minigame.InputAction_BasicPress, JustCut, Miss, Blank); Update(); @@ -69,7 +84,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack private void Update() { - float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - 1, 2); + float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - _rotationLength, _rotationLength * 2); var func = EasingFunction.GetEasingFunction(_ease); @@ -77,6 +92,24 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack transform.localEulerAngles = new Vector3(0, 0, newRotation); } + private void SetObjectCutSprite(int step) + { + switch (_type) + { + case LumBEARjack.HugeType.log: + _logSR.sprite = _logCutSprites[step - 1]; + break; + case LumBEARjack.HugeType.freezer: + _freezerSR.sprite = _freezerCutSprites[step - 1]; + break; + case LumBEARjack.HugeType.peach: + _peachSR.sprite = _peachCutSprites[step - 1]; + break; + default: + break; + } + } + private void JustHit1(PlayerActionEvent caller, float state) { JustHit(caller, state, 1); @@ -115,20 +148,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack _bear.CutMid(); _rotationBeat = _soundsToDeleteIfMiss[step - 1].startBeat + _soundsToDeleteIfMiss[step - 1].timer; - switch (_type) - { - case LumBEARjack.HugeType.log: - _logSR.sprite = _logCutSprites[step - 1]; - break; - case LumBEARjack.HugeType.freezer: - _freezerSR.sprite = _freezerCutSprites[step - 1]; - break; - case LumBEARjack.HugeType.peach: - _peachSR.sprite = _peachCutSprites[step - 1]; - break; - default: - break; - } + SetObjectCutSprite(step); } private void JustCut(PlayerActionEvent caller, float state) diff --git a/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs b/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs index 5fc52aca4..d83f2ae4d 100644 --- a/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs +++ b/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs @@ -23,6 +23,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack private LumBEARjack.SmallType _type; private double _rotationBeat; + private double _rotationLength; private void Awake() { @@ -56,13 +57,14 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack } _rotationBeat = beat + (length / 3 * 2); + _rotationLength = length / 3; LumBEARjack.instance.ScheduleInput(beat, length / 3 * 2, Minigame.InputAction_BasicPress, Just, Miss, Blank); Update(); } private void Update() { - float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - 1, 2); + float normalized = Conductor.instance.GetPositionFromBeat(_rotationBeat - _rotationLength, _rotationLength * 2); var func = EasingFunction.GetEasingFunction(_ease);