Fixing humming bug in BM + Metronome fix + Some games conversion to onbeatpulse
This commit is contained in:
parent
014bf596a9
commit
8b3d98d25d
|
|
@ -82,6 +82,7 @@ namespace HeavenStudio
|
||||||
// Metronome tick sound enabled
|
// Metronome tick sound enabled
|
||||||
public bool metronome = false;
|
public bool metronome = false;
|
||||||
Util.Sound metronomeSound;
|
Util.Sound metronomeSound;
|
||||||
|
private int _metronomeTally = 0;
|
||||||
|
|
||||||
// pitch values
|
// pitch values
|
||||||
private float timelinePitch = 1f;
|
private float timelinePitch = 1f;
|
||||||
|
|
@ -204,6 +205,7 @@ namespace HeavenStudio
|
||||||
|
|
||||||
songPosBeat = GetBeatFromSongPos(time);
|
songPosBeat = GetBeatFromSongPos(time);
|
||||||
startBeat = songPosBeat;
|
startBeat = songPosBeat;
|
||||||
|
_metronomeTally = 0;
|
||||||
|
|
||||||
startTime = DateTime.Now;
|
startTime = DateTime.Now;
|
||||||
absTimeAdjust = 0;
|
absTimeAdjust = 0;
|
||||||
|
|
@ -363,13 +365,10 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
if (metronome && isPlaying)
|
if (metronome && isPlaying)
|
||||||
{
|
{
|
||||||
if (ReportBeat(ref lastReportedBeat))
|
if (songPositionInBeatsAsDouble >= Math.Ceiling(startBeat) + _metronomeTally)
|
||||||
{
|
{
|
||||||
metronomeSound = Util.SoundByte.PlayOneShot("metronome", lastReportedBeat);
|
metronomeSound = Util.SoundByte.PlayOneShot("metronome", Math.Ceiling(startBeat) + _metronomeTally);
|
||||||
}
|
_metronomeTally++;
|
||||||
else if (songPositionInBeats < lastReportedBeat)
|
|
||||||
{
|
|
||||||
lastReportedBeat = Mathf.Round(songPositionInBeats);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,14 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
|
||||||
game = BoardMeeting.instance;
|
game = BoardMeeting.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
if (rollLoop != null)
|
||||||
|
{
|
||||||
|
rollLoop.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Prepare()
|
public void Prepare()
|
||||||
{
|
{
|
||||||
if (spinning) return;
|
if (spinning) return;
|
||||||
|
|
@ -78,7 +86,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
|
||||||
|
|
||||||
public void Bop()
|
public void Bop()
|
||||||
{
|
{
|
||||||
if (!canBop || spinning || !anim.IsAnimationNotPlaying() || preparing) return;
|
if (!canBop || spinning || preparing) return;
|
||||||
if (smileCounter > 0)
|
if (smileCounter > 0)
|
||||||
{
|
{
|
||||||
anim.DoScaledAnimationAsync("SmileBop", 0.5f);
|
anim.DoScaledAnimationAsync("SmileBop", 0.5f);
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,8 @@ namespace HeavenStudio.Games
|
||||||
public BMExecutive firstSpinner;
|
public BMExecutive firstSpinner;
|
||||||
[SerializeField] float shakeIntensity = 0.5f;
|
[SerializeField] float shakeIntensity = 0.5f;
|
||||||
public bool shouldBop = true;
|
public bool shouldBop = true;
|
||||||
bool assistantCanBop = true;
|
private bool assistantCanBop = true;
|
||||||
bool executivesCanBop = true;
|
private bool executivesCanBop = true;
|
||||||
public GameEvent bop = new GameEvent();
|
public GameEvent bop = new GameEvent();
|
||||||
[NonSerialized] public Sound chairLoopSound = null;
|
[NonSerialized] public Sound chairLoopSound = null;
|
||||||
int missCounter = 0;
|
int missCounter = 0;
|
||||||
|
|
@ -126,10 +126,6 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
if (cond.isPlaying && !cond.isPaused)
|
if (cond.isPlaying && !cond.isPaused)
|
||||||
{
|
{
|
||||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
|
|
||||||
{
|
|
||||||
SingleBop();
|
|
||||||
}
|
|
||||||
if (PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_BasicPress.inputLockCategory))
|
if (PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_BasicPress.inputLockCategory))
|
||||||
{
|
{
|
||||||
if (executives[executiveCount - 1].spinning)
|
if (executives[executiveCount - 1].spinning)
|
||||||
|
|
@ -147,6 +143,12 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnBeatPulse(double beat)
|
||||||
|
{
|
||||||
|
if (!shouldBop) return;
|
||||||
|
SingleBop();
|
||||||
|
}
|
||||||
|
|
||||||
void SingleBop()
|
void SingleBop()
|
||||||
{
|
{
|
||||||
if (assistantCanBop)
|
if (assistantCanBop)
|
||||||
|
|
|
||||||
|
|
@ -208,13 +208,13 @@ namespace HeavenStudio.Games
|
||||||
// print("current beat: " + conductor.songPositionInBeatsAsDouble);
|
// print("current beat: " + conductor.songPositionInBeatsAsDouble);
|
||||||
if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeatsAsDouble)
|
if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeatsAsDouble)
|
||||||
{
|
{
|
||||||
plalinAnim.Play("idle", 0, 0);
|
plalinAnim.DoScaledAnimationAsync("idle", 0.5f);
|
||||||
stopCatchLeft = 0;
|
stopCatchLeft = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeatsAsDouble)
|
if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeatsAsDouble)
|
||||||
{
|
{
|
||||||
alalinAnim.Play("idle", 0, 0);
|
alalinAnim.DoScaledAnimationAsync("idle", 0.5f);
|
||||||
stopCatchRight = 0;
|
stopCatchRight = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,19 +236,6 @@ namespace HeavenStudio.Games
|
||||||
heartMessage.SetActive(false);
|
heartMessage.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
|
||||||
{
|
|
||||||
if (bopLeft && stopCatchLeft == 0)
|
|
||||||
{
|
|
||||||
plalinAnim.Play("bop", 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bopRight && stopCatchRight == 0)
|
|
||||||
{
|
|
||||||
alalinAnim.Play("bop", 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerInput.GetIsAction(InputAction_Left) && !IsExpectingInputNow(InputAction_Left.inputLockCategory))
|
if (PlayerInput.GetIsAction(InputAction_Left) && !IsExpectingInputNow(InputAction_Left.inputLockCategory))
|
||||||
{
|
{
|
||||||
catchWhiff(false);
|
catchWhiff(false);
|
||||||
|
|
@ -260,6 +247,19 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnBeatPulse(double beat)
|
||||||
|
{
|
||||||
|
if (bopLeft && stopCatchLeft == 0)
|
||||||
|
{
|
||||||
|
plalinAnim.DoScaledAnimationAsync("bop", 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bopRight && stopCatchRight == 0)
|
||||||
|
{
|
||||||
|
alalinAnim.DoScaledAnimationAsync("bop", 0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void DropFruit(double beat, int side, bool smile, bool isPineapple, float endSmile)
|
public void DropFruit(double beat, int side, bool smile, bool isPineapple, float endSmile)
|
||||||
{
|
{
|
||||||
var objectToSpawn = isPineapple ? pineappleBase : orangeBase;
|
var objectToSpawn = isPineapple ? pineappleBase : orangeBase;
|
||||||
|
|
@ -344,23 +344,23 @@ namespace HeavenStudio.Games
|
||||||
case (int)WhoBops.Plalin:
|
case (int)WhoBops.Plalin:
|
||||||
if (stopCatchLeft == 0)
|
if (stopCatchLeft == 0)
|
||||||
{
|
{
|
||||||
plalinAnim.Play("bop", 0, 0);
|
plalinAnim.DoScaledAnimationAsync("bop", 0.5f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (int)WhoBops.Alalin:
|
case (int)WhoBops.Alalin:
|
||||||
if (stopCatchRight == 0)
|
if (stopCatchRight == 0)
|
||||||
{
|
{
|
||||||
alalinAnim.Play("bop", 0, 0);
|
alalinAnim.DoScaledAnimationAsync("bop", 0.5f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (int)WhoBops.Both:
|
case (int)WhoBops.Both:
|
||||||
if (stopCatchRight == 0)
|
if (stopCatchRight == 0)
|
||||||
{
|
{
|
||||||
alalinAnim.Play("bop", 0, 0);
|
alalinAnim.DoScaledAnimationAsync("bop", 0.5f);
|
||||||
}
|
}
|
||||||
if (stopCatchLeft == 0)
|
if (stopCatchLeft == 0)
|
||||||
{
|
{
|
||||||
plalinAnim.Play("bop", 0, 0);
|
plalinAnim.DoScaledAnimationAsync("bop", 0.5f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -374,12 +374,12 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
if (side)
|
if (side)
|
||||||
{
|
{
|
||||||
alalinAnim.Play(anim, 0, 0);
|
alalinAnim.DoScaledAnimationAsync(anim, 0.5f);
|
||||||
stopCatchRight = beat + 0.9f;
|
stopCatchRight = beat + 0.9f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plalinAnim.Play(anim, 0, 0);
|
plalinAnim.DoScaledAnimationAsync(anim, 0.5f);
|
||||||
stopCatchLeft = beat + 0.9f;
|
stopCatchLeft = beat + 0.9f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,12 +402,12 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
if (side)
|
if (side)
|
||||||
{
|
{
|
||||||
alalinAnim.Play("miss" + fruitType, 0, 0);
|
alalinAnim.DoScaledAnimationAsync("miss" + fruitType, 0.5f);
|
||||||
stopCatchRight = beat + 0.7f;
|
stopCatchRight = beat + 0.7f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plalinAnim.Play("miss" + fruitType, 0, 0);
|
plalinAnim.DoScaledAnimationAsync("miss" + fruitType, 0.5f);
|
||||||
stopCatchLeft = beat + 0.7f;
|
stopCatchLeft = beat + 0.7f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -438,12 +438,12 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
if (side)
|
if (side)
|
||||||
{
|
{
|
||||||
alalinAnim.Play("whiff", 0, 0);
|
alalinAnim.DoScaledAnimationAsync("whiff", 0.5f);
|
||||||
stopCatchRight = beat + 0.5f;
|
stopCatchRight = beat + 0.5f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plalinAnim.Play("whiff", 0, 0);
|
plalinAnim.DoScaledAnimationAsync("whiff", 0.5f);
|
||||||
stopCatchLeft = beat + 0.5f;
|
stopCatchLeft = beat + 0.5f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,13 +262,15 @@ namespace HeavenStudio.Games
|
||||||
UpdateCameraZoom();
|
UpdateCameraZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnBeatPulse(double beat)
|
||||||
|
{
|
||||||
|
if (!shouldBop) return;
|
||||||
|
BopSingle();
|
||||||
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
|
|
||||||
{
|
|
||||||
BopSingle();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cond.isPlaying && !cond.isPaused)
|
if (cond.isPlaying && !cond.isPaused)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue