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} platformHandler: {fileID: 6715217060937385611}
jumpPaths: jumpPaths:
- name: Jump - name: Jump
preview: 1 preview: 0
anchor: {fileID: 0} anchor: {fileID: 0}
positions: positions:
- tag: - tag:
@ -725,6 +725,24 @@ MonoBehaviour:
duration: 0 duration: 0
useLastRealPos: 0 useLastRealPos: 0
values: [] 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 --- !u!1 &4465275889429203320
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

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