accomadation for persist/stretch

This commit is contained in:
Rapandrasmus 2024-02-04 17:04:24 +01:00
parent 9f4655f20e
commit 849234931f
3 changed files with 49 additions and 21 deletions

View file

@ -21,6 +21,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private PlayerActionEvent _cutActionEvent; private PlayerActionEvent _cutActionEvent;
private double _rotationBeat; private double _rotationBeat;
private double _rotationLength;
public void Init(LBJBear bear, double beat, double length, LumBEARjack.BigType type, double startUpBeat = -1) 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; _type = type;
_rotationBeat = beat + (length / 4 * 2); _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); 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); _cutActionEvent = LumBEARjack.instance.ScheduleInput(beat, length / 4 * 3, Minigame.InputAction_BasicPress, JustCut, Miss, Blank);
Update(); Update();
} }
private void 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); var func = EasingFunction.GetEasingFunction(_ease);

View file

@ -25,6 +25,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3]; private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3];
private double _rotationBeat; private double _rotationBeat;
private double _rotationLength;
private void Awake() private void Awake()
{ {
@ -54,14 +55,28 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
} }
_rotationBeat = beat + (length / 6 * 2); _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); 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); 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); 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); _soundsToDeleteIfMiss[2] = LumBEARjack.instance.ScheduleInput(beat, length / 6 * 5, Minigame.InputAction_BasicPress, JustCut, Miss, Blank);
Update(); Update();
@ -69,7 +84,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private void 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); var func = EasingFunction.GetEasingFunction(_ease);
@ -77,6 +92,24 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
transform.localEulerAngles = new Vector3(0, 0, newRotation); 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) private void JustHit1(PlayerActionEvent caller, float state)
{ {
JustHit(caller, state, 1); JustHit(caller, state, 1);
@ -115,20 +148,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
_bear.CutMid(); _bear.CutMid();
_rotationBeat = _soundsToDeleteIfMiss[step - 1].startBeat + _soundsToDeleteIfMiss[step - 1].timer; _rotationBeat = _soundsToDeleteIfMiss[step - 1].startBeat + _soundsToDeleteIfMiss[step - 1].timer;
switch (_type) SetObjectCutSprite(step);
{
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 JustCut(PlayerActionEvent caller, float state) private void JustCut(PlayerActionEvent caller, float state)

View file

@ -23,6 +23,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private LumBEARjack.SmallType _type; private LumBEARjack.SmallType _type;
private double _rotationBeat; private double _rotationBeat;
private double _rotationLength;
private void Awake() private void Awake()
{ {
@ -56,13 +57,14 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
} }
_rotationBeat = beat + (length / 3 * 2); _rotationBeat = beat + (length / 3 * 2);
_rotationLength = length / 3;
LumBEARjack.instance.ScheduleInput(beat, length / 3 * 2, Minigame.InputAction_BasicPress, Just, Miss, Blank); LumBEARjack.instance.ScheduleInput(beat, length / 3 * 2, Minigame.InputAction_BasicPress, Just, Miss, Blank);
Update(); Update();
} }
private void 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); var func = EasingFunction.GetEasingFunction(_ease);