Bop Refactor + Tweaks/Fixes (#582)

* blue bear tweaks

* OnBeatPulse callback added

* Fixing humming bug in BM + Metronome fix + Some games conversion to onbeatpulse

* clappy trio to drumming practice

* rest of the games converted

* two minor changes
This commit is contained in:
Rapandrasmus 2023-11-23 17:19:39 +01:00 committed by GitHub
parent 4505018ec7
commit 43df22b463
35 changed files with 365 additions and 374 deletions

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2448776798073114dbaa07b1c4a83cd8
guid: b570a8e729c2e6c47bfe22048bcc0e8c
AudioImporter:
externalObjects: {}
serializedVersion: 6
@ -18,5 +18,5 @@ AudioImporter:
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleName: ctrbear/common
assetBundleVariant:

View file

@ -76,12 +76,10 @@ namespace HeavenStudio
// Conductor is currently paused, but not fully stopped
public bool isPaused;
// Last reported beat based on song position
private double lastReportedBeat = 0f;
// Metronome tick sound enabled
public bool metronome = false;
Util.Sound metronomeSound;
private int _metronomeTally = 0;
// pitch values
private float timelinePitch = 1f;
@ -204,6 +202,7 @@ namespace HeavenStudio
songPosBeat = GetBeatFromSongPos(time);
startBeat = songPosBeat;
_metronomeTally = 0;
startTime = DateTime.Now;
absTimeAdjust = 0;
@ -363,13 +362,10 @@ namespace HeavenStudio
{
if (metronome && isPlaying)
{
if (ReportBeat(ref lastReportedBeat))
if (songPositionInBeatsAsDouble >= Math.Ceiling(startBeat) + _metronomeTally)
{
metronomeSound = Util.SoundByte.PlayOneShot("metronome", lastReportedBeat);
}
else if (songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(songPositionInBeats);
metronomeSound = Util.SoundByte.PlayOneShot("metronome", Math.Ceiling(startBeat) + _metronomeTally);
_metronomeTally++;
}
}
else
@ -382,6 +378,7 @@ namespace HeavenStudio
}
}
[Obsolete("Conductor.ReportBeat is deprecated. Please use the OnBeatPulse callback instead.")]
public bool ReportBeat(ref double lastReportedBeat, double offset = 0, bool shiftBeatToOffset = true)
{
bool result = songPositionInBeats + (shiftBeatToOffset ? offset : 0f) >= (lastReportedBeat) + 1f;

View file

@ -47,6 +47,7 @@ namespace HeavenStudio
[NonSerialized] public bool playOnStart;
[NonSerialized] public double startBeat;
[NonSerialized] public GameObject currentGameO;
private Minigame _currentMinigame;
[NonSerialized] public bool autoplay;
[NonSerialized] public bool canInput = true;
[NonSerialized] public RiqEntity currentSection, nextSection;
@ -70,6 +71,7 @@ namespace HeavenStudio
public event Action<double> onBeatChanged;
public event Action<RiqEntity> onSectionChange;
public event Action<double> onBeatPulse;
public int BeatmapEntities()
{
@ -493,6 +495,13 @@ namespace HeavenStudio
}
}
if (cond.songPositionInBeatsAsDouble >= Math.Ceiling(_playStartBeat) + _pulseTally)
{
if (_currentMinigame != null) _currentMinigame.OnBeatPulse(Math.Ceiling(_playStartBeat) + _pulseTally);
onBeatPulse?.Invoke(Math.Ceiling(_playStartBeat) + _pulseTally);
_pulseTally++;
}
float seekTime = 8f;
//seek ahead to preload games that have assetbundles
SeekAheadAndPreload(cond.songPositionInBeatsAsDouble, seekTime);
@ -580,10 +589,15 @@ namespace HeavenStudio
#region Play Events
private double _playStartBeat = 0;
private int _pulseTally = 0;
public void Play(double beat, float delay = 0f)
{
bool paused = Conductor.instance.isPaused;
Debug.Log("Playing at " + beat);
_playStartBeat = beat;
_pulseTally = 0;
canInput = true;
if (!paused)
{
@ -951,6 +965,10 @@ namespace HeavenStudio
Destroy(currentGameO);
currentGameO = Instantiate(GetGame(game));
if (currentGameO.TryGetComponent<Minigame>(out var minigame))
{
_currentMinigame = minigame;
}
currentGameO.transform.parent = eventCaller.GamesHolder.transform;
currentGameO.name = game;

View file

@ -126,9 +126,9 @@ namespace HeavenStudio.Games
public GameObject individualBagHolder;
[Header("Variables")]
static int rightCrumbAppearThreshold = 15;
static int leftCrumbAppearThreshold = 30;
static int eatenTreats = 0;
private int rightCrumbAppearThreshold = 15;
private int leftCrumbAppearThreshold = 30;
private int eatenTreats = 0;
bool crying;
private List<RiqEntity> _allStoryEvents = new();
[SerializeField] private SuperCurveObject.Path[] _treatCurves;
@ -236,7 +236,6 @@ namespace HeavenStudio.Games
private void Awake()
{
instance = this;
if (Conductor.instance.isPlaying || Conductor.instance.isPaused) EatTreat(true);
_allStoryEvents = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "story" });
UpdateStory();
}
@ -292,12 +291,12 @@ namespace HeavenStudio.Games
if (PlayerInput.GetIsAction(InputAction_Left) && !IsExpectingInputNow(InputAction_Left.inputLockCategory))
{
SoundByte.PlayOneShotGame("blueBear/whiff");
SoundByte.PlayOneShotGame("blueBear/whiff", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-1, 2), false));
Bite(true);
}
else if (PlayerInput.GetIsAction(InputAction_Right) && !IsExpectingInputNow(InputAction_Right.inputLockCategory))
{
SoundByte.PlayOneShotGame("blueBear/whiff");
SoundByte.PlayOneShotGame("blueBear/whiff", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-1, 2), false));
Bite(false);
}
@ -373,12 +372,14 @@ namespace HeavenStudio.Games
{
HandleTreatsOnStart(beat);
HandleEmotions(beat);
HandleCrumbs(beat);
}
public override void OnGameSwitch(double beat)
{
HandleTreatsOnStart(beat);
HandleEmotions(beat);
HandleCrumbs(beat);
}
private void HandleTreatsOnStart(double gameswitchBeat)
@ -412,6 +413,15 @@ namespace HeavenStudio.Games
}
}
private void HandleCrumbs(double beat)
{
var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "crumb" }).FindAll(x => x.beat < beat);
if (allEventsBeforeBeat.Count == 0) return;
var lastCrumbEvent = allEventsBeforeBeat[^1];
SetCrumbThreshold(lastCrumbEvent["right"], lastCrumbEvent["left"], lastCrumbEvent["reset"]);
EatTreat(false);
}
public void SetCrumbThreshold(int rightThreshold, int leftThreshold, bool reset)
{
rightCrumbAppearThreshold = rightThreshold;
@ -419,9 +429,9 @@ namespace HeavenStudio.Games
if (reset) eatenTreats = 0;
}
public void EatTreat(bool onlyCheck = false)
public void EatTreat(bool appendTreats = true)
{
if (!onlyCheck) eatenTreats++;
if (appendTreats) eatenTreats++;
if (eatenTreats >= leftCrumbAppearThreshold)
{
leftCrumb.SetActive(true);

View file

@ -22,6 +22,14 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
game = BoardMeeting.instance;
}
private void OnDestroy()
{
if (rollLoop != null)
{
rollLoop.Stop();
}
}
public void Prepare()
{
if (spinning) return;
@ -78,7 +86,7 @@ namespace HeavenStudio.Games.Scripts_BoardMeeting
public void Bop()
{
if (!canBop || spinning || !anim.IsAnimationNotPlaying() || preparing) return;
if (!canBop || spinning || preparing) return;
if (smileCounter > 0)
{
anim.DoScaledAnimationAsync("SmileBop", 0.5f);

View file

@ -92,8 +92,8 @@ namespace HeavenStudio.Games
public BMExecutive firstSpinner;
[SerializeField] float shakeIntensity = 0.5f;
public bool shouldBop = true;
bool assistantCanBop = true;
bool executivesCanBop = true;
private bool assistantCanBop = true;
private bool executivesCanBop = true;
public GameEvent bop = new GameEvent();
[NonSerialized] public Sound chairLoopSound = null;
int missCounter = 0;
@ -126,10 +126,6 @@ namespace HeavenStudio.Games
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 (executives[executiveCount - 1].spinning)
@ -147,6 +143,12 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (!shouldBop) return;
SingleBop();
}
void SingleBop()
{
if (assistantCanBop)

View file

@ -208,13 +208,13 @@ namespace HeavenStudio.Games
// print("current beat: " + conductor.songPositionInBeatsAsDouble);
if (stopCatchLeft > 0 && stopCatchLeft <= cond.songPositionInBeatsAsDouble)
{
plalinAnim.Play("idle", 0, 0);
plalinAnim.DoScaledAnimationAsync("idle", 0.5f);
stopCatchLeft = 0;
}
if (stopCatchRight > 0 && stopCatchRight <= cond.songPositionInBeatsAsDouble)
{
alalinAnim.Play("idle", 0, 0);
alalinAnim.DoScaledAnimationAsync("idle", 0.5f);
stopCatchRight = 0;
}
@ -236,19 +236,6 @@ namespace HeavenStudio.Games
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))
{
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)
{
var objectToSpawn = isPineapple ? pineappleBase : orangeBase;
@ -344,23 +344,23 @@ namespace HeavenStudio.Games
case (int)WhoBops.Plalin:
if (stopCatchLeft == 0)
{
plalinAnim.Play("bop", 0, 0);
plalinAnim.DoScaledAnimationAsync("bop", 0.5f);
}
break;
case (int)WhoBops.Alalin:
if (stopCatchRight == 0)
{
alalinAnim.Play("bop", 0, 0);
alalinAnim.DoScaledAnimationAsync("bop", 0.5f);
}
break;
case (int)WhoBops.Both:
if (stopCatchRight == 0)
{
alalinAnim.Play("bop", 0, 0);
alalinAnim.DoScaledAnimationAsync("bop", 0.5f);
}
if (stopCatchLeft == 0)
{
plalinAnim.Play("bop", 0, 0);
plalinAnim.DoScaledAnimationAsync("bop", 0.5f);
}
break;
default:
@ -374,12 +374,12 @@ namespace HeavenStudio.Games
if (side)
{
alalinAnim.Play(anim, 0, 0);
alalinAnim.DoScaledAnimationAsync(anim, 0.5f);
stopCatchRight = beat + 0.9f;
}
else
{
plalinAnim.Play(anim, 0, 0);
plalinAnim.DoScaledAnimationAsync(anim, 0.5f);
stopCatchLeft = beat + 0.9f;
}
@ -402,12 +402,12 @@ namespace HeavenStudio.Games
if (side)
{
alalinAnim.Play("miss" + fruitType, 0, 0);
alalinAnim.DoScaledAnimationAsync("miss" + fruitType, 0.5f);
stopCatchRight = beat + 0.7f;
}
else
{
plalinAnim.Play("miss" + fruitType, 0, 0);
plalinAnim.DoScaledAnimationAsync("miss" + fruitType, 0.5f);
stopCatchLeft = beat + 0.7f;
}
}
@ -438,12 +438,12 @@ namespace HeavenStudio.Games
if (side)
{
alalinAnim.Play("whiff", 0, 0);
alalinAnim.DoScaledAnimationAsync("whiff", 0.5f);
stopCatchRight = beat + 0.5f;
}
else
{
plalinAnim.Play("whiff", 0, 0);
plalinAnim.DoScaledAnimationAsync("whiff", 0.5f);
stopCatchLeft = beat + 0.5f;
}
}

View file

@ -262,13 +262,15 @@ namespace HeavenStudio.Games
UpdateCameraZoom();
}
public override void OnBeatPulse(double beat)
{
if (!shouldBop) return;
BopSingle();
}
void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
{
BopSingle();
}
if (cond.isPlaying && !cond.isPaused)
{

View file

@ -135,13 +135,14 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (shouldBop) Bop(Conductor.instance.songPositionInBeatsAsDouble);
}
void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop) Bop(cond.songPositionInBeatsAsDouble);
}
if (cond.isPlaying && !cond.isPaused)
{
float normalizedBeat = cond.GetPositionFromBeat(signStartBeat, signLength);

View file

@ -165,95 +165,48 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (!goBop) return;
if (student.isHolding)
{
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
{
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
//PostScratchoFace();
}
if (!andStop && !djYellowHolding)
{
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft);
djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed));
if (djYellowBopLeft)
{
djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f);
}
else
{
djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
djYellowBopLeft = !djYellowBopLeft;
}
else if (djYellowHolding)
{
djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
}
private void Update()
{
#region old script
//var cond = Conductor.instance;
//if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//{
// if (cond.songPositionInBeatsAsDouble >= bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length)
// {
// if (student.anim.IsAnimationNotPlaying())
// {
// if (student.isHolding)
// {
// student.anim.Play("HoldBop", 0, 0);
// }
// else
// {
// student.anim.Play("IdleBop", 0, 0);
// }
// }
// if (djYellowAnim.IsAnimationNotPlaying())
// {
// var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
// if (yellowState.IsName("Hey"))
// {
// PostScratchoFace();
// }
// if (djYellowHolding)
// {
// djYellowAnim.Play("HoldBop", 0, 0);
// }
// else
// {
// // todo: split between left and right bop based on beat
// djYellowAnim.Play("IdleBop", 0, 0);
// }
// }
// }
//}
#endregion
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
{
if (goBop)
{
if (student.isHolding)
{
student.anim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
{
student.anim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
//PostScratchoFace();
}
if (!andStop && !djYellowHolding)
{
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft);
djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed));
if (djYellowBopLeft)
{
djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f);
}
else
{
djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f);
}
djYellowBopLeft = !djYellowBopLeft;
}
else if (djYellowHolding)
{
djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f);
}
}
}
else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat)
{
lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble);
}
if(PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !student.isHolding) //Start hold miss
{
student.OnMissHoldForPlayerInput();

View file

@ -17,11 +17,12 @@ namespace HeavenStudio.Games.Loaders
{
new GameAction("Bop", "Bop")
{
function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity["toggle"]); },
defaultLength = 0.5f,
function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["auto"], eventCaller.currentEntity["toggle"]); },
resizable = true,
parameters = new List<Param>()
{
new Param("toggle", false, "Enable Bopping", "Whether to bop to the beat or not"),
new Param("toggle", true, "Enable Bopping", "Whether to bop to the beat or not"),
new Param("auto", false, "Enable Bopping (Auto)", "Whether to bop to the beat or not automatically"),
}
},
new GameAction("Prepare", "Prepare")
@ -141,7 +142,7 @@ namespace HeavenStudio.Games
private double lastReportedBeat = 0f;
private bool birdOnScreen = false;
static bool dontBop = false;
bool dontBop = false;
private const string sfxNum = "dogNinja/";
public static DogNinja instance;
@ -213,6 +214,12 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (dontBop) return;
DogAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
private void Update()
{
if (DogAnim.GetBool("needPrepare") && DogAnim.IsAnimationNotPlaying())
@ -258,17 +265,18 @@ namespace HeavenStudio.Games
}
}
private void LateUpdate()
public void Bop(double beat, float length, bool auto, bool bop)
{
if (Conductor.instance.ReportBeat(ref lastReportedBeat) && DogAnim.IsAnimationNotPlaying() && !dontBop)
{
DogAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
}
dontBop = !auto;
if (!bop) return;
List<BeatAction.Action> actions = new();
public void Bop(double beat, bool bop)
{
dontBop = !bop;
for (int i = 0; i < length; i++)
{
actions.Add(new(beat + i, delegate { DogAnim.DoScaledAnimationAsync("Bop", 0.5f); }));
}
if (actions.Count > 0) BeatAction.New(this, actions);
}
public static void QueueObject(double beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow)

View file

@ -138,6 +138,11 @@ namespace HeavenStudio.Games
clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance);
}
public override void OnBeatPulse(double beat)
{
if (shouldBop) SingleBop();
}
void Update()
{
var cond = Conductor.instance;
@ -162,10 +167,6 @@ namespace HeavenStudio.Games
}
queuedBalls.Clear();
}
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
{
SingleBop();
}
}
else
{

View file

@ -144,16 +144,17 @@ namespace HeavenStudio.Games
PersistColor(beat);
}
public override void OnBeatPulse(double beat)
{
if (goBop)
{
Bop();
}
}
private void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (goBop)
{
Bop();
}
}
if (isMoving && cond.isPlaying && !cond.isPaused)
{

View file

@ -204,8 +204,6 @@ namespace HeavenStudio.Games
private List<GameObject> Spectators;
//bop-type animations
private GameEvent bop = new GameEvent();
private GameEvent specBop = new GameEvent();
private GameEvent noBop = new GameEvent();
private GameEvent noResponse = new GameEvent();
private GameEvent noCall = new GameEvent();
@ -356,30 +354,28 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
var cond = Conductor.instance;
if (goBopIdol)
{
if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length))
{
idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0);
Blue.PlayAnimState("Beat");
Orange.PlayAnimState("Beat");
}
}
if (goBopSpec)
{
if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length))
BopAll();
}
}
private void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (goBopIdol)
{
if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length))
{
idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0);
Blue.PlayAnimState("Beat");
Orange.PlayAnimState("Beat");
}
}
}
if (cond.ReportBeat(ref specBop.lastReportedBeat, specBop.startBeat % 1))
{
if (goBopSpec)
{
if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length))
BopAll();
}
}
//idol jumping physics
float jumpPos = cond.GetPositionFromBeat(idolJumpStartTime, 1f);

View file

@ -230,16 +230,17 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (goBopFlip) SingleBop((int)WhoBops.Flippers);
if (goBopTuck) SingleBop((int)WhoBops.CaptainTuck);
}
private void Update()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (goBopFlip) SingleBop((int)WhoBops.Flippers);
if (goBopTuck) SingleBop((int)WhoBops.CaptainTuck);
}
if (isWalking)
{
float normalizedBeat = cond.GetPositionFromBeat(walkStartBeat, walkLength);

View file

@ -69,16 +69,6 @@ namespace HeavenStudio.Games.Loaders
},
resizable = true
},
new GameAction("bop", "Bop")
{
function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.Bop(e.beat, e.length, e["bop"], e["autoBop"]); },
parameters = new List<Param>()
{
new Param("bop", true, "Keep Bopping", "Should Fork bop for the duration of the block?"),
new Param("autoBop", false, "Keep Bopping (Auto)", "Should Fork bop indefinitely?"),
},
resizable = true,
},
},
new List<string>() {"rvl", "normal"},
"rvlfork", "en",

View file

@ -27,7 +27,6 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
public int currentEarlyPeasOnFork;
public int currentPerfectPeasOnFork;
public int currentLatePeasOnFork;
private double lastReportedBeat;
private bool isEating = false;
@ -49,16 +48,6 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
{
Stab(null);
}
if (Conductor.instance.ReportBeat(ref lastReportedBeat) && anim.IsAnimationNotPlaying() && shouldBop)
{
SingleBop();
}
}
public void SingleBop()
{
anim.DoScaledAnimationAsync("Player_Bop", 0.5f);
}
public void Eat()

View file

@ -1166,6 +1166,11 @@ namespace HeavenStudio.Games
Wind.windMain = windStrength;
}
public override void OnBeatPulse(double beat)
{
Joe.RequestBop();
}
public void ToggleBop(double beat, float length, bool toggle, bool autoBop)
{
Joe.bop.length = autoBop ? float.MaxValue : 0;

View file

@ -51,6 +51,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
public bool inNuriLock { get { return (Conductor.instance.songPositionInBeatsAsDouble >= noNuriJabTime && Conductor.instance.songPositionInBeatsAsDouble < noNuriJabTime + 1f); } }
public void RequestBop()
{
var cond = Conductor.instance;
if (cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo) Bop();
}
private void Update()
{
var cond = Conductor.instance;
@ -95,11 +101,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan
anim.Play("Beat", -1, 0);
}
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo)
{
Bop();
}
if (inCombo && shouldComboId == -2)
{
float missProg = cond.GetPositionFromBeat(lastComboMissTime, 3f);

View file

@ -336,18 +336,19 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (goBop)
{
PlayStepperAnim("Bop", true, 0.5f);
}
}
private void Update()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (goBop)
{
PlayStepperAnim("Bop", true, 0.5f);
}
}
if (queuedInputs.Count > 0)
{
foreach (var input in queuedInputs)

View file

@ -157,10 +157,9 @@ namespace HeavenStudio.Games
}
}
private void LateUpdate()
public override void OnBeatPulse(double beat)
{
if (Conductor.instance.ReportBeat(ref lastReportedBeat)
&& !BossAnim.IsPlayingAnimationName("BossCall")
if (!BossAnim.IsPlayingAnimationName("BossCall")
&& !BossAnim.IsPlayingAnimationName("BossSignal")
&& bossBop)
{

View file

@ -412,6 +412,12 @@ namespace HeavenStudio.Games
}
}
// mainly for bopping logic
public virtual void OnBeatPulse(double beat)
{
}
public static MultiSound PlaySoundSequence(string game, string name, double startBeat, params SoundSequence.SequenceParams[] args)
{
Minigames.Minigame gameInfo = GameManager.instance.GetGameInfo(game);

View file

@ -349,24 +349,24 @@ namespace HeavenStudio.Games
}
}
private void LateUpdate()
public override void OnBeatPulse(double beat)
{
if (Conductor.instance.ReportBeat(ref lastReportedBeat)) {
if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationName("Bop") || MonkAnim.IsPlayingAnimationName("Idle"))
if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationName("Bop") || MonkAnim.IsPlayingAnimationName("Idle"))
&& monkBop
&& !isStaring)
{
MonkAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
&& !isStaring)
{
MonkAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
if (!MonkAnim.IsPlayingAnimationName("Blush") || !MonkAnim.IsPlayingAnimationName("Stare")) {
if (growLevel == 4) BrowAnim.DoScaledAnimationAsync("Bop", 0.5f);
if (growLevel > 0) StacheAnim.DoScaledAnimationAsync($"Bop{growLevel}", 0.5f);
}
if (!MonkAnim.IsPlayingAnimationName("Blush") || !MonkAnim.IsPlayingAnimationName("Stare"))
{
if (growLevel == 4) BrowAnim.DoScaledAnimationAsync("Bop", 0.5f);
if (growLevel > 0) StacheAnim.DoScaledAnimationAsync($"Bop{growLevel}", 0.5f);
}
if (CloudMonkey.activeInHierarchy) {
CloudMonkey.GetComponent<Animator>().DoScaledAnimationAsync("Bop", 0.5f);
}
if (CloudMonkey.activeInHierarchy) //Why activeInHierarchy? - Rasmus
{
CloudMonkey.GetComponent<Animator>().DoScaledAnimationAsync("Bop", 0.5f); //DONT DO THIS!!! GetComponent is a really expensive operation - Rasmus
}
}

View file

@ -17,7 +17,6 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
public bool isSqueezed;
public bool isPreparing;
public double queuePrepare;
public double lastReportedBeat = 0f;
double lastSqueezeBeat;
bool isActive = true;
@ -65,10 +64,9 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
}
}
void LateUpdate()
public void RequestBop()
{
if (Conductor.instance.ReportBeat(ref lastReportedBeat)
&& !anim.IsPlayingAnimationName("Bop")
if (!anim.IsPlayingAnimationName("Bop")
&& !anim.IsPlayingAnimationName("Happy")
&& !anim.IsPlayingAnimationName("Angry")
&& !anim.IsPlayingAnimationName("Oops")

View file

@ -206,7 +206,6 @@ namespace HeavenStudio.Games
bool autoAction;
double intervalStartBeat;
float beatInterval = 1f;
double lastReportedBeat;
static List<double> queuedSqueezes = new();
static List<double> queuedReleases = new();
@ -253,6 +252,23 @@ namespace HeavenStudio.Games
}
}
public override void OnBeatPulse(double beat)
{
if (bopIterate >= 3)
{
bopStatus =
bopIterate = 0;
autoAction = false;
}
if (autoAction) bopIterate++;
foreach (var octo in octopodes)
{
octo.RequestBop();
}
}
private void Update()
{
BackgroundColorUpdate();
@ -261,17 +277,6 @@ namespace HeavenStudio.Games
if (Text.text is "Wrong! Try Again!" or "Good!") Text.text = "";
queuePrepare = double.MaxValue;
}
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
{
if (bopIterate >= 3) {
bopStatus =
bopIterate = 0;
autoAction = false;
}
if (autoAction) bopIterate++;
}
}
public void ChangeText(string text, string youText)

View file

@ -152,7 +152,6 @@ namespace HeavenStudio.Games
public Paddlers paddlers;
public GameEvent bop = new GameEvent();
private bool goBop = true;
public static RhythmRally instance;
@ -357,16 +356,6 @@ namespace HeavenStudio.Games
}
}
// Paddler bop animation.
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (goBop && !inPose)
{
BopSingle();
}
}
opponentServing = false;
//update camera
@ -375,6 +364,14 @@ namespace HeavenStudio.Games
GameCamera.AdditionalFoV = cameraFOV;
}
public override void OnBeatPulse(double beat)
{
if (goBop && !inPose)
{
BopSingle();
}
}
public void Bop(double beat, float length, bool bop, bool bopAuto)
{
goBop = bopAuto;

View file

@ -84,22 +84,20 @@ namespace HeavenStudio.Games
instance = this;
}
// Update is called once per frame
public override void OnBeatPulse(double beat)
{
if (shouldBop) SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f);
}
void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
{
SomenPlayer.Play("HeadBob", -1, 0);
}
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{
SoundByte.PlayOneShotGame("rhythmSomen/somen_mistake");
FrontArm.Play("ArmPluck", -1, 0);
backArm.Play("BackArmNothing", 0, 0);
FrontArm.DoScaledAnimationAsync("ArmPluck", 0.5f);
backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f);
hasSlurped = false;
EffectSweat.Play("BlobSweating", -1, 0);
EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f);
ScoreMiss();
}
}
@ -108,7 +106,7 @@ namespace HeavenStudio.Games
{
if (!missed)
{
backArm.Play("BackArmLift", 0, 0);
backArm.DoScaledAnimationAsync("BackArmLift", 0.5f);
FrontArm.DoScaledAnimationAsync("ArmSlurp", 0.5f);
hasSlurped = true;
BeatAction.New(instance, new List<BeatAction.Action>()
@ -117,8 +115,8 @@ namespace HeavenStudio.Games
{
if (hasSlurped)
{
backArm.Play("BackArmNothing", 0, 0);
FrontArm.Play("ArmNothing", 0, 0);
backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f);
FrontArm.DoScaledAnimationAsync("ArmNothing", 0.5f);
}
})
});
@ -136,7 +134,7 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat + i, delegate
{
SomenPlayer.Play("HeadBob", -1, 0);
SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f);
})
});
}
@ -155,9 +153,9 @@ namespace HeavenStudio.Games
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}),
new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}),
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}),
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}),
});
}
@ -174,9 +172,9 @@ namespace HeavenStudio.Games
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}),
new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}),
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}),
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}),
});
}
@ -195,12 +193,12 @@ namespace HeavenStudio.Games
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}),
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}),
new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}),
new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}),
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}),
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}),
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}),
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}),
});
}
@ -212,35 +210,35 @@ namespace HeavenStudio.Games
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { EffectExclam.Play("ExclamAppear", -1, 0);}),
new BeatAction.Action(beat, delegate { EffectExclam.DoScaledAnimationAsync("ExclamAppear", 0.5f);}),
});
}
public void CatchSuccess(PlayerActionEvent caller, float state)
{
backArm.Play("BackArmNothing", 0, 0);
backArm.DoScaledAnimationAsync("BackArmNothing", 0, 0);
hasSlurped = false;
splashEffect.Play();
if (state >= 1f || state <= -1f)
{
SoundByte.PlayOneShotGame("rhythmSomen/somen_splash");
FrontArm.Play("ArmPluckNG", -1, 0);
EffectSweat.Play("BlobSweating", -1, 0);
FrontArm.DoScaledAnimationAsync("ArmPluckNG", 0.5f);
EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f);
missed = true;
return;
}
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch");
SoundByte.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f);
FrontArm.Play("ArmPluckOK", -1, 0);
EffectHit.Play("HitAppear", -1, 0);
FrontArm.DoScaledAnimationAsync("ArmPluckOK", 0.5f);
EffectHit.DoScaledAnimationAsync("HitAppear", 0.5f);
missed = false;
}
public void CatchMiss(PlayerActionEvent caller)
{
missed = true;
EffectShock.Play("ShockAppear", -1, 0);
EffectShock.DoScaledAnimationAsync("ShockAppear", 0.5f);
}
public void CatchEmpty(PlayerActionEvent caller)

View file

@ -218,26 +218,27 @@ namespace HeavenStudio.Games
ReporterBlink();
}
public override void OnBeatPulse(double beat)
{
if (shouldBop && canBop)
{
if (UnityEngine.Random.Range(1, 18) == 1)
{
wrestlerAnim.DoScaledAnimationAsync("BopPec");
}
else
{
wrestlerAnim.DoScaledAnimationAsync("Bop");
}
}
}
void Update()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop && canBop)
{
if (UnityEngine.Random.Range(1, 18) == 1)
{
wrestlerAnim.DoScaledAnimationAsync("BopPec");
}
else
{
wrestlerAnim.DoScaledAnimationAsync("Bop");
}
}
}
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !shouldNotInput)
{
if ((PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)

View file

@ -169,16 +169,14 @@ namespace HeavenStudio.Games
instance = this;
}
// Update is called once per frame
public override void OnBeatPulse(double beat)
{
if (goBopSamurai) player.Bop();
if (goBopChild) childParent.GetComponent<NtrSamuraiChild>().Bop();
}
void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (goBopSamurai) player.Bop();
if (goBopChild) childParent.GetComponent<NtrSamuraiChild>().Bop();
}
if (PlayerInput.GetIsAction(InputAction_AltDown))
DoStep();
if (PlayerInput.GetIsAction(InputAction_AltUp) && player.isStepping())

View file

@ -228,6 +228,18 @@ namespace HeavenStudio.Games
colorEnd = defaultBGColor;
}
public override void OnBeatPulse(double beat)
{
if (shouldBop)
{
Bop();
}
if (spaceGrampsShouldBop)
{
GrampsBop();
}
}
// Update is called once per frame
void Update()
{
@ -237,17 +249,6 @@ namespace HeavenStudio.Games
{
scroll.NormalizedX -= xBaseSpeed * xScrollMultiplier * Time.deltaTime;
scroll.NormalizedY -= yBaseSpeed * yScrollMultiplier * Time.deltaTime;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop)
{
Bop();
}
if (spaceGrampsShouldBop)
{
GrampsBop();
}
}
if (isShootingStar)
{
float normalizedBeat = cond.GetPositionFromBeat(shootingStarStartBeat, shootingStarLength);

View file

@ -123,15 +123,16 @@ namespace HeavenStudio.Games
instance = this;
}
public override void OnBeatPulse(double beat)
{
if (shouldBop) SingleBop();
}
private void Update()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (shouldBop && cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
SingleBop();
}
GiraffeUpdate(cond);
JumpUpdate(cond);
ScrollUpdate(cond);

View file

@ -257,23 +257,24 @@ namespace HeavenStudio.Games
instance = this;
}
public override void OnBeatPulse(double beat)
{
if (shouldBop)
{
foreach (var girl in npcGirls)
{
girl.Bop();
}
player.Bop();
}
}
void Update()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop)
{
foreach (var girl in npcGirls)
{
girl.Bop();
}
player.Bop();
}
}
if (queuedPoses.Count > 0)
{
foreach (var pose in queuedPoses)

View file

@ -262,20 +262,20 @@ namespace HeavenStudio.Games
return default(SuperCurveObject.Path);
}
public override void OnBeatPulse(double beat)
{
if (shouldBop)
{
SingleBop();
}
}
private void Update()
{
var cond = Conductor.instance;
BackgroundColorUpdate();
if (cond.isPlaying && !cond.isPaused)
{
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (shouldBop)
{
SingleBop();
}
}
if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch)
{
TossKid next = GetCurrentReceiver();

View file

@ -41,7 +41,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys
public void Bop()
{
if (!anim.IsAnimationNotPlaying() || crouch || preparing) return;
if (crouch || preparing) return;
DoAnimationScaledAsync("Bop", 0.5f);
}

View file

@ -116,18 +116,20 @@ namespace HeavenStudio.Games
instance = this;
}
public override void OnBeatPulse(double beat)
{
var cond = Conductor.instance;
if (!goBop) return;
if ((!playerReady) && cond.songPositionInBeatsAsDouble > playerBopStart)
playerAnim.DoScaledAnimationAsync("Bop");
if (cond.songPositionInBeatsAsDouble > girlBopStart)
girlAnim.DoScaledAnimationAsync("Bop");
}
private void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && goBop)
{
if ((!playerReady) && cond.songPositionInBeatsAsDouble > playerBopStart)
playerAnim.DoScaledAnimationAsync("Bop");
if (cond.songPositionInBeatsAsDouble > girlBopStart)
girlAnim.DoScaledAnimationAsync("Bop");
}
if (cond.isPlaying && !cond.isPaused)
{
if (queuedInputs.Count > 0)