Tweaked landing pos

This commit is contained in:
Rapandrasmus 2023-06-23 19:57:04 +02:00
parent 48c78fd4e9
commit 0dae215181
2 changed files with 48 additions and 3 deletions

View file

@ -708,7 +708,7 @@ MonoBehaviour:
platformHandler: {fileID: 6715217060937385611}
jumpPaths:
- name: Jump
preview: 1
preview: 0
anchor: {fileID: 0}
positions:
- tag:
@ -725,6 +725,24 @@ MonoBehaviour:
duration: 0
useLastRealPos: 0
values: []
- name: Whiff
preview: 1
anchor: {fileID: 0}
positions:
- tag:
pos: {x: 0, y: 0, z: 0}
target: {fileID: 0}
height: 0.5
duration: 0.5
useLastRealPos: 0
values: []
- tag:
pos: {x: 0, y: 0, z: 0}
target: {fileID: 0}
height: 0
duration: 0
useLastRealPos: 0
values: []
--- !u!1 &4465275889429203320
GameObject:
m_ObjectHideFlags: 0

View file

@ -14,13 +14,15 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
Walking,
Jumping,
Shocked,
Falling
Falling,
Whiffing
}
private JumpingState jumpingState;
private AgbNightWalk game;
private double jumpBeat;
[SerializeField] private List<Animator> balloons = new List<Animator>();
private Path jumpPath;
private Path whiffPath;
private Animator anim;
private float fallStartY;
private double playYanFallBeat;
@ -29,6 +31,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
{
game = AgbNightWalk.instance;
jumpPath = game.GetPath("Jump");
whiffPath = game.GetPath("Whiff");
anim = GetComponent<Animator>();
foreach (var balloon in balloons)
{
@ -46,13 +49,19 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
case JumpingState.Jumping:
Vector3 pos = GetPathPositionFromBeat(jumpPath, Math.Min(jumpBeat + 1, cond.songPositionInBeatsAsDouble), jumpBeat);
transform.localPosition = pos;
float normalizedBeat = cond.GetPositionFromBeat(jumpBeat, 1);
float normalizedBeat = cond.GetPositionFromBeat(jumpBeat, jumpPath.positions[0].duration);
if (normalizedBeat >= 1f)
{
Walk();
}
break;
case JumpingState.Walking:
transform.localPosition = Vector3.zero;
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
{
Whiff(cond.songPositionInBeatsAsDouble);
}
break;
case JumpingState.Flying:
transform.localPosition = Vector3.zero;
break;
@ -64,6 +73,15 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
float newPlayYanY = func(fallStartY, -12, normalizedFallBeat);
transform.localPosition = new Vector3(0, newPlayYanY);
break;
case JumpingState.Whiffing:
Vector3 pos2 = GetPathPositionFromBeat(whiffPath, Math.Min(jumpBeat + 0.5, cond.songPositionInBeatsAsDouble), jumpBeat);
transform.localPosition = pos2;
float normalizedBeat2 = cond.GetPositionFromBeat(jumpBeat, 0.5);
if (normalizedBeat2 >= 1f)
{
Walk();
}
break;
}
}
}
@ -90,6 +108,15 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
jumpingState = JumpingState.Jumping;
jumpBeat = beat;
anim.Play("Jump", 0, 0);
jumpPath.positions[0].duration = 1 - (float)Conductor.instance.SecsToBeats(Minigame.earlyTime, Conductor.instance.GetBpmAtBeat(jumpBeat));
Update();
}
public void Whiff(double beat)
{
jumpingState = JumpingState.Whiffing;
jumpBeat = beat;
anim.Play("Jump", 0, 0);
Update();
}