mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:47:37 +02:00
Gameplay: Timing windows use a "smart" BPM scaling system (#86)
* Game: Pajama Party * Pajama Party: bg setup, Mako jump * Pajama Party: mako jumping * Pajama Party: prep landing anim references * Pajama Party: several anims, improved 3d scene * Pajama Party: bg cleanup * Pajama Party: Mako sleeping anims * Pajama Party: All Mako anims, add sounds to fs * Pajama Party: prep monkey prefab * Pajama Party: thrown pillow, prep sequences * Pajama Party: make embarrassed catch not loop whoops * Pajama Party: sound adjust, prefab work * Pajama Party: monkey spawning, basic jumping * Pajama Party: jump sequence no input detection or landing yet * Pajama Party: anims override * Pajama Party: jump cue functional comes with improvements and bugfixes to PlayerActionEvent * Pajama Party: sleep cue functional * Pajama Party: some notes * PlayerActionEvent: more bugfixes * Pajama Party: fully functional throw cue * Pajama Party: start animating sleep cue * Pajama Party: feature-complete * Pajama Party: unfuck layering * Pajama Party: icon also adds Fan Club's concept icon * Pajama Party: cues while unloaded * inverse-scale timing windows based on speed * Fan Club: move to new input system * Fan Club: allow forced animations during calls * Crop Stomp: fix camera shake regression
This commit is contained in:
@ -21,146 +21,85 @@ namespace HeavenStudio.Games.Scripts_FanClub
|
||||
|
||||
[Header("Properties")]
|
||||
[NonSerialized] public bool player = false;
|
||||
[NonSerialized] public bool hitValid = false;
|
||||
public float jumpStartTime = Single.MinValue;
|
||||
bool stopBeat = false;
|
||||
bool stopCharge = false;
|
||||
bool hasJumped = false;
|
||||
|
||||
float clappingStartTime = 0f;
|
||||
|
||||
public SortedList<float, int> upcomingHits;
|
||||
public float startBeat;
|
||||
public int type;
|
||||
public bool doCharge = false;
|
||||
private bool inputHit = false;
|
||||
private bool hasHit = false;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
if (player)
|
||||
upcomingHits = new SortedList<float, int>(); // beat, type
|
||||
|
||||
inputHit = true;
|
||||
hasHit = true;
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Hit(true, type, true);
|
||||
}
|
||||
float clappingStartTime = Single.MinValue;
|
||||
|
||||
public void AddHit(float beat, int type)
|
||||
{
|
||||
inputHit = false;
|
||||
try
|
||||
if (player)
|
||||
{
|
||||
upcomingHits.Add(beat, type);
|
||||
if (type == 0) // normal clap
|
||||
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ClapJust, ClapThrough, Out);
|
||||
else if (type == 1) // jump
|
||||
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_UP, JumpJust, JumpThrough, JumpOut);
|
||||
else if (type == 2) //"kamone" charge
|
||||
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ChargeClapJust, ClapThrough, Out);
|
||||
else //"kamone" long clap (first)
|
||||
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, LongClapJust, ClapThrough, Out);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{}
|
||||
}
|
||||
|
||||
public void Hit(bool _hit, int type = 0, bool fromAutoplay = false)
|
||||
public void ClapJust(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (player && !hasHit)
|
||||
{
|
||||
if (type == 0)
|
||||
ClapStart(_hit, true, doCharge, fromAutoplay);
|
||||
else if (type == 1)
|
||||
JumpStart(_hit, true, fromAutoplay);
|
||||
bool auto = GameManager.instance.autoplay;
|
||||
ClapStart(true, false, auto ? 0.25f : 0f);
|
||||
}
|
||||
|
||||
hasHit = true;
|
||||
public void ChargeClapJust(PlayerActionEvent caller, float state)
|
||||
{
|
||||
bool auto = GameManager.instance.autoplay;
|
||||
ClapStart(true, true, auto ? 1f : 0f);
|
||||
}
|
||||
|
||||
public void LongClapJust(PlayerActionEvent caller, float state)
|
||||
{
|
||||
bool auto = GameManager.instance.autoplay;
|
||||
ClapStart(true, false, auto ? 1f : 0f);
|
||||
}
|
||||
|
||||
public void JumpJust(PlayerActionEvent caller, float state)
|
||||
{
|
||||
JumpStart(true);
|
||||
}
|
||||
|
||||
public void ClapThrough(PlayerActionEvent caller) {
|
||||
FanClub.instance.AngerOnMiss();
|
||||
}
|
||||
|
||||
public void JumpThrough(PlayerActionEvent caller) {
|
||||
FanClub.instance.AngerOnMiss();
|
||||
}
|
||||
|
||||
public void Out(PlayerActionEvent caller) {}
|
||||
|
||||
public void JumpOut(PlayerActionEvent caller) {
|
||||
var cond = Conductor.instance;
|
||||
if (stopCharge)
|
||||
{
|
||||
caller.CanHit(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
// read cue queue and pop when needed
|
||||
if (hasHit)
|
||||
{
|
||||
if (upcomingHits?.Count > 0)
|
||||
{
|
||||
var k = upcomingHits.Keys[0];
|
||||
var v = upcomingHits[k];
|
||||
|
||||
startBeat = k;
|
||||
type = v == 2 ? 0 : v;
|
||||
doCharge = (v == 2);
|
||||
|
||||
// reset our shit to prepare for next hit
|
||||
hasHit = false;
|
||||
ResetState();
|
||||
|
||||
upcomingHits.Remove(k);
|
||||
}
|
||||
else if (Conductor.instance.GetPositionFromBeat(startBeat, 1) >= Minigame.EndTime())
|
||||
{
|
||||
startBeat = Single.MinValue;
|
||||
type = 0;
|
||||
doCharge = false;
|
||||
// DO NOT RESET, wait for future cues
|
||||
}
|
||||
}
|
||||
|
||||
// no input?
|
||||
if (!hasHit && Conductor.instance.GetPositionFromBeat(startBeat, 1f) >= Minigame.EndTime())
|
||||
{
|
||||
FanClub.instance.AngerOnMiss();
|
||||
hasHit = true;
|
||||
}
|
||||
|
||||
// dunno what this is for
|
||||
if (!inputHit && Conductor.instance.GetPositionFromBeat(startBeat, 1) >= Minigame.EndTime())
|
||||
{
|
||||
inputHit = true;
|
||||
}
|
||||
|
||||
if (!hasHit)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1);
|
||||
StateCheck(normalizedBeat);
|
||||
}
|
||||
|
||||
if (player)
|
||||
{
|
||||
if (PlayerInput.Pressed() && type == 0)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit(true);
|
||||
} else if (state.notPerfect())
|
||||
{
|
||||
Hit(false);
|
||||
}
|
||||
}
|
||||
if (PlayerInput.PressedUp() && type == 1)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit(true, type);
|
||||
} else if (state.notPerfect())
|
||||
{
|
||||
Hit(false, type);
|
||||
}
|
||||
}
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (!hasHit || (upcomingHits?.Count == 0 && startBeat == Single.MinValue))
|
||||
FanClub.instance.AngerOnMiss();
|
||||
|
||||
hasJumped = false;
|
||||
stopBeat = true;
|
||||
jumpStartTime = -99f;
|
||||
animator.Play("FanClap", -1, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_clap");
|
||||
Jukebox.PlayOneShotGame("fanClub/crap_impact");
|
||||
clappingStartTime = cond.songPositionInBeats;
|
||||
if (!FanClub.instance.IsExpectingInputNow())
|
||||
{
|
||||
ClapStart(false);
|
||||
}
|
||||
}
|
||||
if (PlayerInput.Pressing())
|
||||
{
|
||||
if (cond.songPositionInBeats > clappingStartTime + 1.5f && !stopCharge)
|
||||
if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && !stopCharge)
|
||||
{
|
||||
animator.Play("FanClapCharge", -1, 0);
|
||||
stopCharge = true;
|
||||
@ -170,13 +109,10 @@ namespace HeavenStudio.Games.Scripts_FanClub
|
||||
{
|
||||
if (stopCharge)
|
||||
{
|
||||
if (!hasHit || (upcomingHits?.Count == 0 && startBeat == Single.MinValue))
|
||||
FanClub.instance.AngerOnMiss();
|
||||
|
||||
animator.Play("FanJump", -1, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_jump");
|
||||
jumpStartTime = cond.songPositionInBeats;
|
||||
stopCharge = false;
|
||||
if (!FanClub.instance.IsExpectingInputNow())
|
||||
{
|
||||
JumpStart(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -212,41 +148,39 @@ namespace HeavenStudio.Games.Scripts_FanClub
|
||||
}
|
||||
}
|
||||
|
||||
public void ClapStart(bool hit, bool force = false, bool doCharge = false, bool fromAutoplay = false)
|
||||
public void ClapStart(bool hit, bool doCharge = false, float autoplayRelease = 0f)
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (hit)
|
||||
{
|
||||
if (doCharge)
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate {
|
||||
if (PlayerInput.Pressing() || fromAutoplay)
|
||||
{
|
||||
animator.Play("FanClapCharge", -1, 0);
|
||||
stopCharge = true;
|
||||
}
|
||||
}),
|
||||
});
|
||||
}
|
||||
else
|
||||
if (!hit)
|
||||
{
|
||||
FanClub.instance.AngerOnMiss();
|
||||
}
|
||||
if (fromAutoplay || !force)
|
||||
{
|
||||
stopBeat = true;
|
||||
jumpStartTime = -99f;
|
||||
animator.Play("FanClap", -1, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_clap");
|
||||
Jukebox.PlayOneShotGame("fanClub/crap_impact");
|
||||
clappingStartTime = cond.songPositionInBeats;
|
||||
}
|
||||
if (fromAutoplay && !doCharge)
|
||||
{
|
||||
|
||||
var cond = Conductor.instance;
|
||||
hasJumped = false;
|
||||
stopBeat = true;
|
||||
jumpStartTime = -99f;
|
||||
animator.Play("FanClap", -1, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_clap");
|
||||
Jukebox.PlayOneShotGame("fanClub/crap_impact");
|
||||
clappingStartTime = cond.songPositionInBeats;
|
||||
|
||||
if (doCharge)
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate {
|
||||
if (PlayerInput.Pressing() || autoplayRelease > 0f)
|
||||
{
|
||||
animator.Play("FanClapCharge", -1, 0);
|
||||
stopCharge = true;
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
if (autoplayRelease > 0f && !doCharge)
|
||||
{
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(cond.songPositionInBeats + autoplayRelease, delegate {
|
||||
animator.Play("FanFree", -1, 0);
|
||||
stopBeat = false;
|
||||
}),
|
||||
@ -255,22 +189,18 @@ namespace HeavenStudio.Games.Scripts_FanClub
|
||||
}
|
||||
}
|
||||
|
||||
public void JumpStart(bool hit, bool force = false, bool fromAutoplay = false)
|
||||
public void JumpStart(bool hit)
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (hit)
|
||||
{}
|
||||
else
|
||||
if (!hit)
|
||||
{
|
||||
FanClub.instance.AngerOnMiss();
|
||||
}
|
||||
if (fromAutoplay || !force)
|
||||
{
|
||||
animator.Play("FanJump", -1, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_jump");
|
||||
jumpStartTime = cond.songPositionInBeats;
|
||||
stopCharge = false;
|
||||
}
|
||||
|
||||
var cond = Conductor.instance;
|
||||
animator.Play("FanJump", -1, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_jump");
|
||||
jumpStartTime = cond.songPositionInBeats;
|
||||
stopCharge = false;
|
||||
}
|
||||
|
||||
public bool IsJumping()
|
||||
|
Reference in New Issue
Block a user