public override void Tick(EntityController cont) { float realOnTime = MusicUtility.BeatsToSeconds(onTime, 115); //i dont care (the solution is to have cont reference the beatmap and read that but we only have 1 song for this game jam so whatever) float realOffTime = MusicUtility.BeatsToSeconds(offTime, 115); cont.MovementInput = cont.InternalTimer % (realOnTime + realOffTime) < realOnTime; }
void Update() { for (int i = 0; i < spawnTimers.Count; i++) { spawnTimers[i] += Time.deltaTime; if (spawnTimers[i] >= spawnRate[i] && MusicUtility.BeatsToSeconds(beatsToStart[i], referenceMap.Bpm) <= referenceMap.TimeSinceStart) { generateEnemy(i); spawnTimers[i] = 0; } } }
IEnumerator FadeAmbience(float from, float to) { ambienceOn = to > from; float start = Time.time; float fadeTime = MusicUtility.BeatsToSeconds(4, Bpm); while (Time.time - start <= fadeTime) { ambienceSource.volume = Mathf.Lerp(from, to, (Time.time - start) / fadeTime); yield return(null); } ambienceSource.volume = to; }
private void Start() { mapToRead = FindObjectOfType <Beatmap>(); pulsateCycleSeconds = MusicUtility.BeatsToSeconds(pulsateCycleBeats, mapToRead.Bpm); }