mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-22 09:35:11 +00:00
change operation order for input checks
This commit is contained in:
parent
6bb135a091
commit
c1415725ff
12 changed files with 81 additions and 149 deletions
|
@ -46,7 +46,7 @@ namespace HeavenStudio
|
||||||
// Current time of the song
|
// Current time of the song
|
||||||
private double time;
|
private double time;
|
||||||
double dspTime;
|
double dspTime;
|
||||||
double absTime, absTimeAdjust, lastAbsTime;
|
double absTime, absTimeAdjust;
|
||||||
double dspSizeSeconds;
|
double dspSizeSeconds;
|
||||||
double dspMargin = 128 / 44100.0;
|
double dspMargin = 128 / 44100.0;
|
||||||
bool deferTimeKeeping = false;
|
bool deferTimeKeeping = false;
|
||||||
|
@ -56,7 +56,7 @@ namespace HeavenStudio
|
||||||
private double dspStart;
|
private double dspStart;
|
||||||
private float dspStartTime => (float)dspStart;
|
private float dspStartTime => (float)dspStart;
|
||||||
public double dspStartTimeAsDouble => dspStart;
|
public double dspStartTimeAsDouble => dspStart;
|
||||||
DateTime startTime, lastMixTime;
|
DateTime startTime;
|
||||||
|
|
||||||
//the beat we started at
|
//the beat we started at
|
||||||
private double startPos;
|
private double startPos;
|
||||||
|
@ -88,7 +88,6 @@ namespace HeavenStudio
|
||||||
private float minigamePitch = 1f;
|
private float minigamePitch = 1f;
|
||||||
public float SongPitch { get => isPaused ? 0f : (timelinePitch * minigamePitch); }
|
public float SongPitch { get => isPaused ? 0f : (timelinePitch * minigamePitch); }
|
||||||
public float TimelinePitch { get => timelinePitch; }
|
public float TimelinePitch { get => timelinePitch; }
|
||||||
private float musicScheduledPitch = 1f;
|
|
||||||
private double musicScheduledTime = 0;
|
private double musicScheduledTime = 0;
|
||||||
|
|
||||||
// volume modifier
|
// volume modifier
|
||||||
|
@ -201,16 +200,15 @@ namespace HeavenStudio
|
||||||
double musicStartDelay = -offset - startPos;
|
double musicStartDelay = -offset - startPos;
|
||||||
if (musicStartDelay > 0)
|
if (musicStartDelay > 0)
|
||||||
{
|
{
|
||||||
musicScheduledTime = dspTime + (musicStartDelay / timelinePitch) + 2*dspSizeSeconds;
|
musicScheduledTime = dspTime + (musicStartDelay / timelinePitch) + 2 * dspSizeSeconds;
|
||||||
dspStart = dspTime + 2*dspSizeSeconds;
|
dspStart = dspTime + 2 * dspSizeSeconds;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
musicScheduledTime = dspTime + 2*dspSizeSeconds;
|
musicScheduledTime = dspTime + 2 * dspSizeSeconds;
|
||||||
dspStart = dspTime + 2*dspSizeSeconds;
|
dspStart = dspTime + 2 * dspSizeSeconds;
|
||||||
}
|
}
|
||||||
musicSource.PlayScheduled(musicScheduledTime);
|
musicSource.PlayScheduled(musicScheduledTime);
|
||||||
musicScheduledPitch = timelinePitch;
|
|
||||||
musicSource.pitch = timelinePitch;
|
musicSource.pitch = timelinePitch;
|
||||||
Debug.Log($"playback scheduled for dsptime {dspStart}");
|
Debug.Log($"playback scheduled for dsptime {dspStart}");
|
||||||
}
|
}
|
||||||
|
@ -221,7 +219,6 @@ namespace HeavenStudio
|
||||||
|
|
||||||
startTime = DateTime.Now;
|
startTime = DateTime.Now;
|
||||||
absTimeAdjust = 0;
|
absTimeAdjust = 0;
|
||||||
lastAbsTime = 0;
|
|
||||||
deferTimeKeeping = musicSource.clip != null;
|
deferTimeKeeping = musicSource.clip != null;
|
||||||
|
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
|
@ -242,7 +239,6 @@ namespace HeavenStudio
|
||||||
absTimeAdjust = 0;
|
absTimeAdjust = 0;
|
||||||
dspStart = dsp;
|
dspStart = dsp;
|
||||||
}
|
}
|
||||||
lastMixTime = DateTime.Now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Pause()
|
public void Pause()
|
||||||
|
|
|
@ -166,11 +166,11 @@ namespace HeavenStudio.Games
|
||||||
public override void OnBeatPulse(double beat)
|
public override void OnBeatPulse(double beat)
|
||||||
{
|
{
|
||||||
if (!BeatIsInBopRegion(beat)) return;
|
if (!BeatIsInBopRegion(beat)) return;
|
||||||
if (student.isHolding)
|
if (student.isHolding && !student.swiping)
|
||||||
{
|
{
|
||||||
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
|
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
|
||||||
}
|
}
|
||||||
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
|
else if (student.anim.IsAnimationNotPlaying() && !student.swiping)
|
||||||
{
|
{
|
||||||
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
|
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
|
||||||
}
|
}
|
||||||
|
@ -217,16 +217,19 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
student.UnHold();
|
student.UnHold();
|
||||||
shouldBeHolding = false;
|
shouldBeHolding = false;
|
||||||
|
ScoreMiss();
|
||||||
}
|
}
|
||||||
else if(PlayerInput.GetIsAction(InputAction_FlickRelease) && !IsExpectingInputNow(InputAction_FlickRelease) && student.isHolding) //Flick during hold
|
else if(PlayerInput.GetIsAction(InputAction_FlickRelease) && !IsExpectingInputNow(InputAction_FlickRelease) && student.isHolding) //Flick during hold
|
||||||
{
|
{
|
||||||
student.OnFlickSwipe();
|
student.OnFlickSwipe();
|
||||||
shouldBeHolding = false;
|
shouldBeHolding = false;
|
||||||
|
ScoreMiss();
|
||||||
}
|
}
|
||||||
else if (!GameManager.instance.autoplay && shouldBeHolding && !PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_FlickRelease))
|
else if (!GameManager.instance.autoplay && shouldBeHolding && !PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_FlickRelease))
|
||||||
{
|
{
|
||||||
student.UnHold();
|
student.UnHold();
|
||||||
shouldBeHolding = false;
|
shouldBeHolding = false;
|
||||||
|
ScoreMiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,11 +252,11 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat + i, delegate
|
new BeatAction.Action(beat + i, delegate
|
||||||
{
|
{
|
||||||
if (student.isHolding)
|
if (student.isHolding && !student.swiping)
|
||||||
{
|
{
|
||||||
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
|
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
|
||||||
}
|
}
|
||||||
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
|
else if (student.anim.IsAnimationNotPlaying() && !student.swiping)
|
||||||
{
|
{
|
||||||
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
|
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
|
||||||
}
|
}
|
||||||
|
@ -469,27 +472,13 @@ namespace HeavenStudio.Games
|
||||||
ScheduleInput(beat, timing, InputAction_FlickRelease, student.OnHitSwipe, student.OnMissSwipe, student.OnEmpty);
|
ScheduleInput(beat, timing, InputAction_FlickRelease, student.OnHitSwipe, student.OnMissSwipe, student.OnEmpty);
|
||||||
}
|
}
|
||||||
andStop = false;
|
andStop = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//void SetupCue(float beat, bool swipe)
|
|
||||||
//{
|
|
||||||
// if (swipe)
|
|
||||||
// student.swipeBeat = beat;
|
|
||||||
// else
|
|
||||||
// student.holdBeat = beat;
|
|
||||||
|
|
||||||
// student.eligible = true;
|
|
||||||
// student.ResetState();
|
|
||||||
//}
|
|
||||||
|
|
||||||
public static void SoundFX(bool toggle)
|
public static void SoundFX(bool toggle)
|
||||||
{
|
{
|
||||||
Student.soundFX = toggle;
|
Student.soundFX = toggle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void VoiceLines(double beat, int type)
|
public static void VoiceLines(double beat, int type)
|
||||||
{
|
{
|
||||||
string[] sounds;
|
string[] sounds;
|
||||||
|
|
|
@ -169,23 +169,21 @@ namespace HeavenStudio.Games.Scripts_DJSchool
|
||||||
public void OnHitSwipe(PlayerActionEvent caller, float beat)
|
public void OnHitSwipe(PlayerActionEvent caller, float beat)
|
||||||
{
|
{
|
||||||
game.shouldBeHolding = false;
|
game.shouldBeHolding = false;
|
||||||
|
isHolding = false;
|
||||||
|
swiping = true;
|
||||||
|
SoundByte.PlayOneShotGame("djSchool/recordSwipe");
|
||||||
|
anim.Play("Swipe", 0, 0);
|
||||||
if (beat >= 1f || beat <= -1f) missed = true;
|
if (beat >= 1f || beat <= -1f) missed = true;
|
||||||
if (!missed)
|
if (!missed)
|
||||||
{
|
{
|
||||||
isHolding = false;
|
|
||||||
|
|
||||||
missed = false;
|
missed = false;
|
||||||
shouldBeHolding = false;
|
shouldBeHolding = false;
|
||||||
SoundByte.PlayOneShotGame("djSchool/recordSwipe");
|
|
||||||
FlashFX(false);
|
FlashFX(false);
|
||||||
swiping = true;
|
|
||||||
|
|
||||||
BeatAction.New(this, new List<BeatAction.Action>()
|
BeatAction.New(this, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat, delegate { anim.Play("Swipe", 0, 0); }),
|
|
||||||
new BeatAction.Action(beat + 4f, delegate { swiping = false; }),
|
new BeatAction.Action(beat + 4f, delegate { swiping = false; }),
|
||||||
});
|
});
|
||||||
//anim.Play("Swipe", 0, 0);
|
|
||||||
game.djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.UpSecond);
|
game.djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.UpSecond);
|
||||||
game.djYellowScript.Reverse();
|
game.djYellowScript.Reverse();
|
||||||
game.smileBeat = caller.timer + caller.startBeat + 1f;
|
game.smileBeat = caller.timer + caller.startBeat + 1f;
|
||||||
|
@ -199,13 +197,10 @@ namespace HeavenStudio.Games.Scripts_DJSchool
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OnMissSwipeForPlayerInput(caller.timer + caller.startBeat + 1);
|
OnMissSwipeForPlayerInput(caller.timer + caller.startBeat + 1);
|
||||||
SoundByte.PlayOneShotGame("djSchool/recordSwipe");
|
|
||||||
BeatAction.New(this, new List<BeatAction.Action>()
|
BeatAction.New(this, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat, delegate { anim.Play("Swipe", 0, 0); }),
|
|
||||||
new BeatAction.Action(beat + 4f, delegate { swiping = false; }),
|
new BeatAction.Action(beat + 4f, delegate { swiping = false; }),
|
||||||
});
|
});
|
||||||
//anim.Play("Swipe", 0, 0);
|
|
||||||
tableAnim.speed = 1;
|
tableAnim.speed = 1;
|
||||||
tableAnim.DoScaledAnimationAsync("Student_Turntable_Swipe", 0.5f);
|
tableAnim.DoScaledAnimationAsync("Student_Turntable_Swipe", 0.5f);
|
||||||
|
|
||||||
|
@ -304,7 +299,6 @@ namespace HeavenStudio.Games.Scripts_DJSchool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Not sure but will do?
|
//Not sure but will do?
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
double lastChargeTime = double.MinValue;
|
double lastChargeTime = double.MinValue;
|
||||||
double unPrepareTime = double.MinValue;
|
double unPrepareTime = double.MinValue;
|
||||||
double noNuriJabTime = double.MinValue;
|
double noNuriJabTime = double.MinValue;
|
||||||
bool canEmote = false;
|
bool canEmote = false, justPunched = false;
|
||||||
public int wantFace = 0;
|
public int wantFace = 0;
|
||||||
|
|
||||||
public bool inSpecial
|
public bool inSpecial
|
||||||
|
@ -137,7 +137,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerInput.GetIsAction(KarateMan.InputAction_Press) && !inSpecial)
|
if (PlayerInput.GetIsAction(KarateMan.InputAction_Press) && !(inSpecial || justPunched))
|
||||||
{
|
{
|
||||||
if (!KarateMan.instance.IsExpectingInputNow(KarateMan.InputAction_Press))
|
if (!KarateMan.instance.IsExpectingInputNow(KarateMan.InputAction_Press))
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,11 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LateUpdate()
|
||||||
|
{
|
||||||
|
justPunched = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Bop()
|
public void Bop()
|
||||||
|
@ -230,19 +234,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
|
|
||||||
switch (forceHand)
|
switch (forceHand)
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
if (cond.songPositionInBeatsAsDouble - lastPunchTime < 0.25f + (Minigame.JustLateTime() - 1f))
|
|
||||||
{
|
|
||||||
lastPunchTime = double.MinValue;
|
|
||||||
anim.DoScaledAnimationAsync("Straight", 0.5f);
|
|
||||||
straight = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lastPunchTime = cond.songPositionInBeatsAsDouble;
|
|
||||||
anim.DoScaledAnimationAsync("Jab", 0.5f);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
anim.DoScaledAnimationAsync("Jab", 0.5f);
|
anim.DoScaledAnimationAsync("Jab", 0.5f);
|
||||||
break;
|
break;
|
||||||
|
@ -255,6 +246,19 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
anim.DoNormalizedAnimation("JabNoNuri");
|
anim.DoNormalizedAnimation("JabNoNuri");
|
||||||
noNuriJabTime = cond.songPositionInBeatsAsDouble;
|
noNuriJabTime = cond.songPositionInBeatsAsDouble;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
if (cond.songPositionInBeatsAsDouble <= cond.GetBeatFromSongPos(lastPunchTime + Minigame.NgLateTime() - 1) + 0.25)
|
||||||
|
{
|
||||||
|
lastPunchTime = double.MinValue;
|
||||||
|
anim.DoScaledAnimationAsync("Straight", 0.5f);
|
||||||
|
straight = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastPunchTime = cond.songPositionAsDouble;
|
||||||
|
anim.DoScaledAnimationAsync("Jab", 0.5f);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (touchCharge)
|
if (touchCharge)
|
||||||
{
|
{
|
||||||
|
@ -265,6 +269,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
{
|
{
|
||||||
bop.startBeat = cond.songPositionInBeatsAsDouble + 0.5f;
|
bop.startBeat = cond.songPositionInBeatsAsDouble + 0.5f;
|
||||||
}
|
}
|
||||||
|
justPunched = true;
|
||||||
return straight; //returns what hand was used to punch the object
|
return straight; //returns what hand was used to punch the object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
case ItemType.ComboPot1:
|
case ItemType.ComboPot1:
|
||||||
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_AltDown, ComboStartJustOrNg, ComboStartThrough, ComboStartOut, CanCombo);
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_AltDown, ComboStartJustOrNg, ComboStartThrough, ComboStartOut, CanCombo);
|
||||||
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_Press, ComboStartWrongAction, ComboStartOut, ComboStartOut, CanHitWrong);
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_Press, ComboStartWrongAction, ComboStartOut, ComboStartOut, CanHitWrong);
|
||||||
|
OnHitWrongAction.weight = 0;
|
||||||
path = 1;
|
path = 1;
|
||||||
break;
|
break;
|
||||||
case ItemType.ComboPot2:
|
case ItemType.ComboPot2:
|
||||||
|
@ -216,6 +217,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
case ItemType.KickBarrel:
|
case ItemType.KickBarrel:
|
||||||
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_Press, KickChargeJustOrNg, ItemThrough, ItemOut, CanCombo);
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_Press, KickChargeJustOrNg, ItemThrough, ItemOut, CanCombo);
|
||||||
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_AltDown, ItemWrongAction, ItemOut, ItemOut, CanComboWrong);
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_AltDown, ItemWrongAction, ItemOut, ItemOut, CanComboWrong);
|
||||||
|
OnHitWrongAction.weight = 0;
|
||||||
path = 1;
|
path = 1;
|
||||||
comboId = -1;
|
comboId = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -243,12 +245,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
case ItemType.Bomb:
|
case ItemType.Bomb:
|
||||||
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_Press, ItemJustOrNg, ItemThrough, ItemOut, CanHit);
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_Press, ItemJustOrNg, ItemThrough, ItemOut, CanHit);
|
||||||
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_AltDown, ItemWrongAction, ItemOut, ItemOut, CanHitWrong);
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_AltDown, ItemWrongAction, ItemOut, ItemOut, CanHitWrong);
|
||||||
|
OnHitWrongAction.weight = 0;
|
||||||
path = 1;
|
path = 1;
|
||||||
comboId = -1;
|
comboId = -1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_Press, ItemJustOrNg, ItemThrough, ItemOut, CanHit);
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, KarateMan.InputAction_Press, ItemJustOrNg, ItemThrough, ItemOut, CanHit);
|
||||||
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_AltDown, ItemWrongAction, ItemOut, ItemOut, CanHitWrong);
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, KarateMan.InputAction_AltDown, ItemWrongAction, ItemOut, ItemOut, CanHitWrong);
|
||||||
|
OnHitWrongAction.weight = 0;
|
||||||
path = 1;
|
path = 1;
|
||||||
comboId = -1;
|
comboId = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -832,6 +836,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
KarateMan.instance.Nori.DoThrough();
|
KarateMan.instance.Nori.DoThrough();
|
||||||
|
KarateMan.instance.ScoreMiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ItemOut(PlayerActionEvent caller) { }
|
public void ItemOut(PlayerActionEvent caller) { }
|
||||||
|
@ -937,6 +942,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
{
|
{
|
||||||
ItemHitEffect(straight);
|
ItemHitEffect(straight);
|
||||||
}
|
}
|
||||||
|
KarateMan.instance.ScoreMiss();
|
||||||
KarateMan.instance.Nori.DoThrough();
|
KarateMan.instance.Nori.DoThrough();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,42 +198,6 @@ namespace HeavenStudio.Games
|
||||||
scheduledInputs.Remove(evt);
|
scheduledInputs.Remove(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the scheduled input that should happen the **Soonest**
|
|
||||||
//Can return null if there's no scheduled inputs
|
|
||||||
// remark: need a check for specific button(s)
|
|
||||||
[Obsolete("Use GetClosestScheduledInput InputAction or InputAction category instead")]
|
|
||||||
public PlayerActionEvent GetClosestScheduledInput(InputType input = InputType.ANY)
|
|
||||||
{
|
|
||||||
PlayerActionEvent closest = null;
|
|
||||||
|
|
||||||
foreach (PlayerActionEvent toCompare in scheduledInputs)
|
|
||||||
{
|
|
||||||
// ignore inputs that are for sequencing in autoplay
|
|
||||||
if (toCompare.autoplayOnly) continue;
|
|
||||||
|
|
||||||
if (closest == null)
|
|
||||||
{
|
|
||||||
if (input == InputType.ANY || (toCompare.inputType & input) != 0)
|
|
||||||
closest = toCompare;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double t1 = closest.startBeat + closest.timer;
|
|
||||||
double t2 = toCompare.startBeat + toCompare.timer;
|
|
||||||
|
|
||||||
// Debug.Log("t1=" + t1 + " -- t2=" + t2);
|
|
||||||
|
|
||||||
if (t2 < t1)
|
|
||||||
{
|
|
||||||
if (input == InputType.ANY || (toCompare.inputType & input) != 0)
|
|
||||||
closest = toCompare;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return closest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerActionEvent GetClosestScheduledInput(int[] actionCats)
|
public PlayerActionEvent GetClosestScheduledInput(int[] actionCats)
|
||||||
{
|
{
|
||||||
int catIdx = (int)PlayerInput.CurrentControlStyle;
|
int catIdx = (int)PlayerInput.CurrentControlStyle;
|
||||||
|
@ -267,22 +231,6 @@ namespace HeavenStudio.Games
|
||||||
return closest;
|
return closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerActionEvent GetClosestScheduledInput(PlayerInput.InputAction action)
|
|
||||||
{
|
|
||||||
return GetClosestScheduledInput(action.inputLockCategory);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Hasn't been tested yet. *Should* work.
|
|
||||||
//Can be used to detect if the user is expected to input something now or not
|
|
||||||
//Useful for strict call and responses games like Tambourine
|
|
||||||
[Obsolete("Use IsExpectingInputNow InputAction or InputAction category instead")]
|
|
||||||
public bool IsExpectingInputNow(InputType wantInput = InputType.ANY)
|
|
||||||
{
|
|
||||||
PlayerActionEvent input = GetClosestScheduledInput(wantInput);
|
|
||||||
if (input == null) return false;
|
|
||||||
return input.IsExpectingInputNow();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsExpectingInputNow(int[] wantActionCategory)
|
public bool IsExpectingInputNow(int[] wantActionCategory)
|
||||||
{
|
{
|
||||||
PlayerActionEvent input = GetClosestScheduledInput(wantActionCategory);
|
PlayerActionEvent input = GetClosestScheduledInput(wantActionCategory);
|
||||||
|
@ -299,43 +247,43 @@ namespace HeavenStudio.Games
|
||||||
public static double NgEarlyTime(float pitch = -1)
|
public static double NgEarlyTime(float pitch = -1)
|
||||||
{
|
{
|
||||||
if (pitch < 0)
|
if (pitch < 0)
|
||||||
return 1f - ngEarlyTime;
|
return 1 - ngEarlyTime;
|
||||||
return 1f - (ngEarlyTimeBase * pitch);
|
return 1 - (ngEarlyTimeBase * pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double JustEarlyTime(float pitch = -1)
|
public static double JustEarlyTime(float pitch = -1)
|
||||||
{
|
{
|
||||||
if (pitch < 0)
|
if (pitch < 0)
|
||||||
return 1f - justEarlyTime;
|
return 1 - justEarlyTime;
|
||||||
return 1f - (justEarlyTimeBase * pitch);
|
return 1 - (justEarlyTimeBase * pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double JustLateTime(float pitch = -1)
|
public static double JustLateTime(float pitch = -1)
|
||||||
{
|
{
|
||||||
if (pitch < 0)
|
if (pitch < 0)
|
||||||
return 1f + justLateTime;
|
return 1 + justLateTime;
|
||||||
return 1f + (justLateTimeBase * pitch);
|
return 1 + (justLateTimeBase * pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double NgLateTime(float pitch = -1)
|
public static double NgLateTime(float pitch = -1)
|
||||||
{
|
{
|
||||||
if (pitch < 0)
|
if (pitch < 0)
|
||||||
return 1f + ngLateTime;
|
return 1 + ngLateTime;
|
||||||
return 1f + (ngLateTimeBase * pitch);
|
return 1 + (ngLateTimeBase * pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double AceEarlyTime(float pitch = -1)
|
public static double AceEarlyTime(float pitch = -1)
|
||||||
{
|
{
|
||||||
if (pitch < 0)
|
if (pitch < 0)
|
||||||
return 1f - aceEarlyTime;
|
return 1 - aceEarlyTime;
|
||||||
return 1f - (aceEarlyTimeBase * pitch);
|
return 1 - (aceEarlyTimeBase * pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double AceLateTime(float pitch = -1)
|
public static double AceLateTime(float pitch = -1)
|
||||||
{
|
{
|
||||||
if (pitch < 0)
|
if (pitch < 0)
|
||||||
return 1f + aceLateTime;
|
return 1 + aceLateTime;
|
||||||
return 1f + (aceLateTimeBase * pitch);
|
return 1 + (aceLateTimeBase * pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnGameSwitch(double beat)
|
public virtual void OnGameSwitch(double beat)
|
||||||
|
|
|
@ -42,8 +42,6 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public bool noAutoplay = false; //Indicates if this PlayerActionEvent is recognized by the autoplay. /!\ Overrides autoPlayOnly /!\
|
public bool noAutoplay = false; //Indicates if this PlayerActionEvent is recognized by the autoplay. /!\ Overrides autoPlayOnly /!\
|
||||||
|
|
||||||
public InputType inputType; //The type of input. Check the InputType class to see a list of all of them
|
|
||||||
|
|
||||||
public bool perfectOnly = false; //Indicates that the input only recognize perfect inputs.
|
public bool perfectOnly = false; //Indicates that the input only recognize perfect inputs.
|
||||||
|
|
||||||
public bool countsForAccuracy = true; //Indicates if the input counts for the accuracy or not. If set to false, it'll not be counted in the accuracy calculation
|
public bool countsForAccuracy = true; //Indicates if the input counts for the accuracy or not. If set to false, it'll not be counted in the accuracy calculation
|
||||||
|
@ -160,11 +158,6 @@ namespace HeavenStudio.Games
|
||||||
if (toCompare.InputAction != null
|
if (toCompare.InputAction != null
|
||||||
&& toCompare.InputAction.inputLockCategory[catIdx] != InputAction.inputLockCategory[catIdx]) continue;
|
&& toCompare.InputAction.inputLockCategory[catIdx] != InputAction.inputLockCategory[catIdx]) continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((toCompare.inputType & this.inputType) == 0) continue;
|
|
||||||
if (!toCompare.IsExpectingInputNow()) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
double t1 = this.startBeat + this.timer;
|
double t1 = this.startBeat + this.timer;
|
||||||
double t2 = toCompare.startBeat + toCompare.timer;
|
double t2 = toCompare.startBeat + toCompare.timer;
|
||||||
|
|
|
@ -4,7 +4,7 @@ MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 5
|
executionOrder: -30
|
||||||
icon: {instanceID: 0}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
|
|
|
@ -177,29 +177,23 @@ namespace HeavenStudio.Games
|
||||||
protected static bool IA_TouchNrm(out double dt)
|
protected static bool IA_TouchNrm(out double dt)
|
||||||
{
|
{
|
||||||
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
||||||
&& (instance.currentReceiver is WhichTossKid.Akachan
|
&& ((instance.currentReceiver is WhichTossKid.Akachan or WhichTossKid.None)
|
||||||
|| (instance.lastReceiver is WhichTossKid.Akachan or WhichTossKid.None
|
|| instance.IsExpectingInputNow(InputAction_Aka))
|
||||||
&& instance.currentReceiver is WhichTossKid.None)
|
&& !(instance.IsExpectingInputNow(InputAction_Ao) || instance.IsExpectingInputNow(InputAction_Kii));
|
||||||
|| (instance.IsExpectingInputNow(InputAction_Aka)
|
|
||||||
&& !(instance.IsExpectingInputNow(InputAction_Ao) || instance.IsExpectingInputNow(InputAction_Kii))));
|
|
||||||
}
|
}
|
||||||
protected static bool IA_TouchDir(out double dt)
|
protected static bool IA_TouchDir(out double dt)
|
||||||
{
|
{
|
||||||
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
||||||
&& (instance.currentReceiver is WhichTossKid.Kiiyan
|
&& ((instance.currentReceiver is WhichTossKid.Kiiyan)
|
||||||
|| (instance.lastReceiver is WhichTossKid.Kiiyan
|
|| instance.IsExpectingInputNow(InputAction_Kii))
|
||||||
&& instance.currentReceiver is WhichTossKid.None)
|
&& !(instance.IsExpectingInputNow(InputAction_Ao) || instance.IsExpectingInputNow(InputAction_Aka));
|
||||||
|| (instance.IsExpectingInputNow(InputAction_Kii)
|
|
||||||
&& !(instance.IsExpectingInputNow(InputAction_Ao) || instance.IsExpectingInputNow(InputAction_Aka))));
|
|
||||||
}
|
}
|
||||||
protected static bool IA_TouchAlt(out double dt)
|
protected static bool IA_TouchAlt(out double dt)
|
||||||
{
|
{
|
||||||
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
||||||
&& (instance.currentReceiver is WhichTossKid.Aokun
|
&& ((instance.currentReceiver is WhichTossKid.Aokun)
|
||||||
|| (instance.lastReceiver is WhichTossKid.Aokun
|
|| instance.IsExpectingInputNow(InputAction_Ao))
|
||||||
&& instance.currentReceiver is WhichTossKid.None)
|
&& !(instance.IsExpectingInputNow(InputAction_Aka) || instance.IsExpectingInputNow(InputAction_Kii));
|
||||||
|| (instance.IsExpectingInputNow(InputAction_Ao)
|
|
||||||
&& !(instance.IsExpectingInputNow(InputAction_Aka) || instance.IsExpectingInputNow(InputAction_Kii))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static bool IA_BatonNrm(out double dt)
|
protected static bool IA_BatonNrm(out double dt)
|
||||||
|
|
|
@ -58,15 +58,19 @@ namespace HeavenStudio.Util
|
||||||
if (behaviour == null || !(conductor.isPlaying || conductor.isPaused))
|
if (behaviour == null || !(conductor.isPlaying || conductor.isPaused))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
while (conductor.songPositionInBeatsAsDouble >= actions[idx].beat)
|
||||||
{
|
{
|
||||||
actions[idx].function.Invoke();
|
try
|
||||||
|
{
|
||||||
|
actions[idx].function.Invoke();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Exception thrown while executing BeatAction: {e}");
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
if (idx >= actions.Count) return;
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Exception thrown while executing BeatAction: {e}");
|
|
||||||
}
|
|
||||||
idx++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace HeavenStudio.Util
|
||||||
bool queued = false;
|
bool queued = false;
|
||||||
public bool available = true;
|
public bool available = true;
|
||||||
|
|
||||||
const double PREBAKE_TIME = 0.5;
|
const double PREBAKE_TIME = 0.25;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,5 +55,8 @@ MonoBehaviour:
|
||||||
- Assets/Scripts/Games/TrickClass/TrickClass.cs
|
- Assets/Scripts/Games/TrickClass/TrickClass.cs
|
||||||
- Assets/Scripts/GameInitializer.cs
|
- Assets/Scripts/GameInitializer.cs
|
||||||
- Assets/Scripts/LevelEditor/Timeline/Timeline.cs
|
- Assets/Scripts/LevelEditor/Timeline/Timeline.cs
|
||||||
|
- Assets/Scripts/Games/PlayerActionEvent.cs
|
||||||
|
- Assets/Scripts/Games/KarateMan/KarateManPot.cs
|
||||||
|
- Assets/Scripts/Games/DJSchool/DJSchool.cs
|
||||||
PathsToSkipImportEvent: []
|
PathsToSkipImportEvent: []
|
||||||
PathsToIgnoreOverwriteSettingOnAttribute: []
|
PathsToIgnoreOverwriteSettingOnAttribute: []
|
||||||
|
|
Loading…
Reference in a new issue