mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 03:35:10 +00:00
Conductor: property that returns secPerBeat scaled to song pitch
NEEDS TESTING
This commit is contained in:
parent
7ff421c497
commit
5d95c9ec16
5 changed files with 11 additions and 8 deletions
|
@ -17,6 +17,9 @@ namespace HeavenStudio
|
|||
// The number of seconds for each song beat
|
||||
public float secPerBeat;
|
||||
|
||||
// The number of seconds for each song beat, inversely scaled to song pitch (higer pitch = shorter time)
|
||||
public float pitchedSecPerBeat => (secPerBeat / musicSource.pitch);
|
||||
|
||||
// Current song position, in seconds
|
||||
private float songPos; // for Conductor use only
|
||||
public float songPosition;
|
||||
|
@ -237,7 +240,7 @@ namespace HeavenStudio
|
|||
// convert real seconds to beats
|
||||
public float GetRestFromRealTime(float seconds)
|
||||
{
|
||||
return seconds/secPerBeat;
|
||||
return seconds/pitchedSecPerBeat;
|
||||
}
|
||||
|
||||
public void SetBpm(float bpm)
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace HeavenStudio.Games
|
|||
const float stepDistance = 2.115f;
|
||||
public static float[] moleSoundOffsets = new float[]{ 0.134f, 0.05f, 0.061f };
|
||||
|
||||
float scrollRate => stepDistance / (Conductor.instance.secPerBeat * 2f / Conductor.instance.musicSource.pitch);
|
||||
float scrollRate => stepDistance / (Conductor.instance.pitchedSecPerBeat * 2f);
|
||||
float grassWidth;
|
||||
float dotsWidth = 19.2f;
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
|||
|
||||
var veggieScale = veggieTrans.localScale;
|
||||
veggieTrans.localScale = new Vector3(veggieScale.x * 0.5f, veggieScale.y, veggieScale.z);
|
||||
squashTween = veggieTrans.DOScaleX(veggieScale.x, cond.secPerBeat * 0.5f / cond.musicSource.pitch);
|
||||
squashTween = veggieTrans.DOScaleX(veggieScale.x, cond.pitchedSecPerBeat * 0.5f);
|
||||
|
||||
ResetState();
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace HeavenStudio.Games
|
|||
var sound = new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound(sounds[0], beat),
|
||||
new MultiSound.Sound(sounds[1], beat + 1f - (0.030f/Conductor.instance.secPerBeat)*Conductor.instance.musicSource.pitch),
|
||||
new MultiSound.Sound(sounds[1], beat + 1f, offset: 0.030f),
|
||||
new MultiSound.Sound("", beat + 2f)
|
||||
};
|
||||
|
||||
|
@ -136,7 +136,7 @@ namespace HeavenStudio.Games
|
|||
var sound = new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("djSchool/andStop1", beat),
|
||||
new MultiSound.Sound("djSchool/andStop2", beat + .5f - (0.1200f/Conductor.instance.secPerBeat)*Conductor.instance.musicSource.pitch),
|
||||
new MultiSound.Sound("djSchool/andStop2", beat + .5f, offset: 0.1200f),
|
||||
new MultiSound.Sound("", beat + 1.5f)
|
||||
};
|
||||
|
||||
|
@ -178,8 +178,8 @@ namespace HeavenStudio.Games
|
|||
new MultiSound.Sound(sounds[0], beat),
|
||||
new MultiSound.Sound(sounds[1], beat + .25f),
|
||||
new MultiSound.Sound(sounds[2], beat + .5f),
|
||||
new MultiSound.Sound(sounds[3], beat + 1f - (0.0500f/Conductor.instance.secPerBeat)*Conductor.instance.musicSource.pitch),
|
||||
new MultiSound.Sound(sounds[4], beat + 2f - (0.070f/Conductor.instance.secPerBeat)*Conductor.instance.musicSource.pitch),
|
||||
new MultiSound.Sound(sounds[3], beat + 1f, offset: 0.0500f),
|
||||
new MultiSound.Sound(sounds[4], beat + 2f, offset: 0.070f),
|
||||
});
|
||||
|
||||
BeatAction.New(djYellow, new List<BeatAction.Action>()
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
|
|||
// SCHEDULING zoom sound so it lines up with when it meets the fork.
|
||||
var currentDspTime = AudioSettings.dspTime;
|
||||
var cond = Conductor.instance;
|
||||
var zoomStartTime = currentDspTime + (double)(cond.secPerBeat * 2 / cond.musicSource.pitch) - 0.317;
|
||||
var zoomStartTime = currentDspTime + (double)(cond.pitchedSecPerBeat * 2) - 0.317;
|
||||
Jukebox.PlayOneShotScheduledGame("forkLifter/zoomFast", (double)zoomStartTime);
|
||||
|
||||
GetComponentInChildren<SpriteRenderer>().sprite = ForkLifter.instance.peaSprites[type];
|
||||
|
|
Loading…
Reference in a new issue