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