more game tweaks

This commit is contained in:
minenice55 2024-04-06 01:07:46 -04:00
parent b88280cfe3
commit 9d14932b02
5 changed files with 21 additions and 18 deletions

View file

@ -41,6 +41,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
path.positions[0].height = pathToCopy.positions[0].height; path.positions[0].height = pathToCopy.positions[0].height;
path.positions[1].pos = pathToCopy.positions[1].pos; path.positions[1].pos = pathToCopy.positions[1].pos;
game.ScheduleInput(startBeat, flyBeats, isCake ? BlueBear.InputAction_Left : BlueBear.InputAction_Right, Just, Out, Out); game.ScheduleInput(startBeat, flyBeats, isCake ? BlueBear.InputAction_Left : BlueBear.InputAction_Right, Just, Out, Out);
startBeat = Conductor.instance.GetUnSwungBeat(startBeat);
Update(); Update();
} }
@ -52,7 +53,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
private void Update() private void Update()
{ {
var cond = Conductor.instance; var cond = Conductor.instance;
transform.localPosition = GetPathPositionFromBeat(path, cond.songPositionInBeatsAsDouble, startBeat); transform.localPosition = GetPathPositionFromBeat(path, cond.unswungSongPositionInBeatsAsDouble, startBeat);
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats); float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
if (flyPos > 2f) if (flyPos > 2f)
@ -75,7 +76,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
SoundByte.PlayOneShotGame("blueBear/chompDonut"); SoundByte.PlayOneShotGame("blueBear/chompDonut");
} }
game.Bite(Conductor.instance.songPositionInBeatsAsDouble, isCake, hold); game.Bite(Conductor.instance.unswungSongPositionInBeatsAsDouble, isCake, hold);
game.EatTreat(); game.EatTreat();
SpawnCrumbs(); SpawnCrumbs();
@ -100,7 +101,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
path.positions[0].height = barelyHeight; path.positions[0].height = barelyHeight;
path.positions[0].duration = 1; path.positions[0].duration = 1;
path.positions[1].pos = new Vector3(path.positions[0].pos.x + (isCake ? -barelyDistX : barelyDistX), path.positions[0].pos.y + barelyDistY); path.positions[1].pos = new Vector3(path.positions[0].pos.x + (isCake ? -barelyDistX : barelyDistX), path.positions[0].pos.y + barelyDistY);
startBeat = Conductor.instance.songPositionInBeatsAsDouble; startBeat = Conductor.instance.unswungSongPositionInBeatsAsDouble;
Update(); Update();
return; return;
} }

View file

@ -74,11 +74,11 @@ namespace HeavenStudio.Games.Scripts_CatchyTune
{ {
if (barelyStart > 0f) if (barelyStart > 0f)
{ {
anim.DoScaledAnimation("barely", barelyStart, isPineapple ? 2f : 1f, clamp: true); anim.DoScaledAnimation("barely", Conductor.instance.GetUnSwungBeat(barelyStart), isPineapple ? 2f : 1f, clamp: true);
} }
else else
{ {
anim.DoScaledAnimation("fruit bounce", startBeat, beatLength + (isPineapple ? 4f : 2f), clamp: true); anim.DoScaledAnimation("fruit bounce", Conductor.instance.GetUnSwungBeat(startBeat), beatLength + (isPineapple ? 4f : 2f), clamp: true);
} }
} }
@ -136,7 +136,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune
if (state <= -1f || state >= 1f) if (state <= -1f || state >= 1f)
{ {
//near miss (barely) //near miss (barely)
barelyStart = Conductor.instance.songPositionInBeatsAsDouble; barelyStart = Conductor.instance.unswungSongPositionInBeatsAsDouble;
game.catchBarely(side); game.catchBarely(side);

View file

@ -39,10 +39,11 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer
} }
public void Init(Kicker kicker, double dispensedBeat) public void Init(Kicker kicker, double dispensedBeat)
{ {
Conductor conductor = Conductor.instance;
this.kicker = kicker; this.kicker = kicker;
kicker.ball = this; kicker.ball = this;
kicker.dispenserBeat = dispensedBeat; kicker.dispenserBeat = dispensedBeat;
double currentBeat = Conductor.instance.songPositionInBeatsAsDouble; double currentBeat = conductor.unswungSongPositionInBeatsAsDouble;
kickPath = SpaceSoccer.instance.GetPath("Kick"); kickPath = SpaceSoccer.instance.GetPath("Kick");
dispensePath = SpaceSoccer.instance.GetPath("Dispense"); dispensePath = SpaceSoccer.instance.GetPath("Dispense");
highKickPath = SpaceSoccer.instance.GetPath("HighKick"); highKickPath = SpaceSoccer.instance.GetPath("HighKick");
@ -53,7 +54,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer
{ {
//Debug.Log("Dispensing"); //Debug.Log("Dispensing");
state = State.Dispensing; state = State.Dispensing;
startBeat = dispensedBeat; startBeat = conductor.GetUnSwungBeat(dispensedBeat);
nextAnimBeat = startBeat + GetAnimLength(State.Dispensing); nextAnimBeat = startBeat + GetAnimLength(State.Dispensing);
kicker.kickTimes = 0; kicker.kickTimes = 0;
return; return;
@ -74,31 +75,32 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer
//Debug.Log("Setting state to kicked"); //Debug.Log("Setting state to kicked");
state = State.Kicked; state = State.Kicked;
double relativeBeat = currentBeat - dispensedBeat; double relativeBeat = currentBeat - dispensedBeat;
startBeat = dispensedBeat + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. startBeat = conductor.GetUnSwungBeat(dispensedBeat) + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation.
nextAnimBeat = startBeat + GetAnimLength(State.Kicked); nextAnimBeat = startBeat + GetAnimLength(State.Kicked);
kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1; //every high kick has 2 kicks in the same time a regular keep-up does 3 kicks. kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1; //every high kick has 2 kicks in the same time a regular keep-up does 3 kicks.
break; break;
} }
else else
{ {
highKickSwing = 0.5f;
if (highKicks[i].beat + GetAnimLength(State.HighKicked) > currentBeat) if (highKicks[i].beat + GetAnimLength(State.HighKicked) > currentBeat)
{ {
highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat);
//Debug.Log("Setting state to high kick"); //Debug.Log("Setting state to high kick");
state = State.HighKicked; state = State.HighKicked;
double relativeBeat = highKicks[i].beat - dispensedBeat; double relativeBeat = highKicks[i].beat - dispensedBeat;
startBeat = dispensedBeat + Math.Ceiling(relativeBeat); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly. startBeat = conductor.GetUnSwungBeat(dispensedBeat) + Math.Ceiling(relativeBeat); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly.
nextAnimBeat = startBeat + GetAnimLength(State.HighKicked); nextAnimBeat = startBeat + GetAnimLength(State.HighKicked);
kicker.kickTimes = (int)Math.Ceiling(relativeBeat) - numHighKicks - 1; kicker.kickTimes = (int)Math.Ceiling(relativeBeat) - numHighKicks - 1;
break; break;
} }
else else
{ {
highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat + GetAnimLength(State.HighKicked));
//Debug.Log("Setting state to toe"); //Debug.Log("Setting state to toe");
state = State.Toe; state = State.Toe;
double relativeBeat = Math.Ceiling(highKicks[i].beat - dispensedBeat) + GetAnimLength(State.HighKicked); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly. double relativeBeat = Math.Ceiling(highKicks[i].beat - dispensedBeat) + GetAnimLength(State.HighKicked); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly.
startBeat = dispensedBeat + relativeBeat; startBeat = conductor.GetUnSwungBeat(dispensedBeat) + relativeBeat;
nextAnimBeat = startBeat + GetAnimLength(State.Toe); nextAnimBeat = startBeat + GetAnimLength(State.Toe);
kicker.kickTimes = (int)(relativeBeat - GetAnimLength(State.HighKicked)) - numHighKicks; kicker.kickTimes = (int)(relativeBeat - GetAnimLength(State.HighKicked)) - numHighKicks;
break; break;
@ -110,7 +112,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer
//Debug.Log("Defaulting to kicked state"); //Debug.Log("Defaulting to kicked state");
state = State.Kicked; state = State.Kicked;
double relativeBeat = currentBeat - dispensedBeat; double relativeBeat = currentBeat - dispensedBeat;
startBeat = dispensedBeat + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. startBeat = conductor.GetUnSwungBeat(dispensedBeat) + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation.
nextAnimBeat = startBeat + GetAnimLength(State.Kicked); nextAnimBeat = startBeat + GetAnimLength(State.Kicked);
kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1; kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1;
} }
@ -178,7 +180,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer
private void Update() private void Update()
{ {
double beat = Conductor.instance.songPositionInBeatsAsDouble; double beat = Conductor.instance.unswungSongPositionInBeatsAsDouble;
switch (state) //handle animations switch (state) //handle animations
{ {
case State.None: //the only time any ball should ever have this state is if it's the unused offscreen ball (which is the only reason this state exists) case State.None: //the only time any ball should ever have this state is if it's the unused offscreen ball (which is the only reason this state exists)
@ -270,7 +272,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer
case State.Kicked: case State.Kicked:
return 1f; return 1f;
case State.HighKicked: case State.HighKicked:
return 2f - highKickSwing; return 1f + highKickSwing;
case State.Toe: case State.Toe:
return 2f - (1f - highKickSwing); return 2f - (1f - highKickSwing);
default: default:

View file

@ -20,7 +20,7 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz
void Update() void Update()
{ {
songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - game.wizardBeatOffset); songPos = (float)(Conductor.instance.unswungSongPositionInBeatsAsDouble - game.wizardBeatOffset);
var am = game.beatInterval / 2f; var am = game.beatInterval / 2f;
var x = Mathf.Sin(Mathf.PI * songPos / am) * game.xRange; var x = Mathf.Sin(Mathf.PI * songPos / am) * game.xRange;
var y = Mathf.Cos(Mathf.PI * songPos / am) * game.yRange; var y = Mathf.Cos(Mathf.PI * songPos / am) * game.yRange;

View file

@ -224,7 +224,7 @@ namespace HeavenStudio.Games
intervalStartBeat = beat; intervalStartBeat = beat;
foreach (var plant in currentPlants) foreach (var plant in currentPlants)
{ {
var songPos = (float)(plant.createBeat - wizardBeatOffset); var songPos = (float)(conductor.GetUnSwungBeat(plant.createBeat) - wizardBeatOffset);
var am = (beatInterval / 2f); var am = (beatInterval / 2f);
var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange; var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange;
var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f); var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f);
@ -261,7 +261,7 @@ namespace HeavenStudio.Games
if (!spawnedInactive) SoundByte.PlayOneShotGame("wizardsWaltz/plant", beat); if (!spawnedInactive) SoundByte.PlayOneShotGame("wizardsWaltz/plant", beat);
Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent<Plant>(); Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent<Plant>();
currentPlants.Add(plant); currentPlants.Add(plant);
var songPos = (float)(beat - wizardBeatOffset); var songPos = (float)(conductor.GetUnSwungBeat(beat) - wizardBeatOffset);
var am = (beatInterval / 2f); var am = (beatInterval / 2f);
var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange; var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange;
var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f); var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f);