This commit is contained in:
Rapandrasmus 2023-07-14 15:55:08 +02:00
parent 15d4b13251
commit 7d9e4f10e5
3 changed files with 43 additions and 9 deletions

View file

@ -1043,7 +1043,7 @@ MonoBehaviour:
elephantStart: 0.004
elephantHangCameraMoveLength: 2
elephantHangMaxDip: 1
elephantReleaseMoveLength: 6
elephantReleaseMoveLength: 8.304
giraffeRef: {fileID: 5248028064811562821, guid: 72e69b6337a6bc04f86ffcf5bcedab92, type: 3}
giraffeDistance: 0
giraffeStart: 0

View file

@ -23,11 +23,13 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
private double startBeat = double.MinValue;
private float halfAngle;
private EasingFunction.Function func;
private AnimalAcrobat game;
private void Awake()
{
halfAngle = fullRotateAngle / 2;
func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuad);
game = AnimalAcrobat.instance;
}
public void Init(double beat, double gameSwitchBeat)
@ -53,6 +55,7 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
}),
});
}
game.ScheduleInput(beat - 1, 1, InputType.STANDARD_DOWN, JustHold, Empty, Empty);
Update();
}
@ -70,17 +73,40 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
float normalizedSwingBeat = cond.GetPositionFromBeat(startBeat, holdLength);
float negativeOffset = (normalizedSwingBeat < 0) ? -1 : 0;
float normalizedAdjusted = Mathf.Abs(normalizedSwingBeat % 1);
if ((Mathf.Floor(normalizedSwingBeat) + negativeOffset) % 2 == 0)
bool goingRight = (Mathf.Floor(normalizedSwingBeat) + negativeOffset) % 2 == 0;
float dirMult = goingRight ? 1 : -1;
rotatePivot.localEulerAngles = new Vector3(0, 0, func(-halfAngle * dirMult, halfAngle * dirMult, normalizedAdjusted));
if (type == ObstacleType.Monkeys) anim.DoNormalizedAnimation("WhiteMonkeysSwing", normalizedAdjusted);
}
private void JustHold(PlayerActionEvent caller, float state)
{
SoundByte.PlayOneShotGame("animalAcrobat/grab");
game.ScheduleInput(startBeat, holdLength, InputType.STANDARD_UP, JustRelease, Empty, Empty);
}
private void JustRelease(PlayerActionEvent caller, float state)
{
double beat = caller.startBeat + caller.timer;
switch (type)
{
rotatePivot.localEulerAngles = new Vector3(0, 0, func(-halfAngle, halfAngle, normalizedAdjusted));
if (type == ObstacleType.Monkeys) anim.DoNormalizedAnimation("WhiteMonkeysSwing", normalizedAdjusted);
}
else
{
rotatePivot.localEulerAngles = new Vector3(0, 0, func(halfAngle, -halfAngle, normalizedAdjusted));
if (type == ObstacleType.Monkeys) anim.DoNormalizedAnimation("WhiteMonkeysSwing", 1 - normalizedAdjusted);
case ObstacleType.Giraffe:
SoundByte.PlayOneShotGame("animalAcrobat/giraffeRelease");
SoundByte.PlayOneShotGame("animalAcrobat/giraffeReleaseLoop", beat, 1, 1, true).SetLoopParams(beat + 4, 0);
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("animalAcrobat/flip", beat + 3),
new MultiSound.Sound("cymbal", beat + 4)
});
break;
default:
SoundByte.PlayOneShotGame("animalAcrobat/release");
SoundByte.PlayOneShotGame("animalAcrobat/flip", beat + 1);
break;
}
}
private void Empty(PlayerActionEvent caller) { }
}
}

View file

@ -119,6 +119,12 @@ namespace HeavenStudio.Games
}
}
private void StartJump(double beat)
{
SoundByte.PlayOneShotGame("animalAcrobat/beginningLeap", beat);
}
#region Camera
private void CameraMoveUpdate(Conductor cond)
{
if (movesIndex >= moves.Count) return;
@ -200,6 +206,7 @@ namespace HeavenStudio.Games
GameCamera.additionalPosition = new Vector3(newPosX, newPosY, 0);
}
}
#endregion
#region Spawn Animals
public override void OnPlay(double beat)
@ -218,6 +225,7 @@ namespace HeavenStudio.Games
if (animalEvents.Count == 0) return;
animalEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
double nextBeat = animalEvents[0].beat;
StartJump(nextBeat - 1);
float startPos = animalEvents[0].datamodel switch
{
"animalAcrobat/elephant" => elephantStart - elephantDistance,