b1fab52ad9
* add Jukebox library todo: - saving / loading of new format - inferrence of unknown data like past versions - move the temporary float casts to proper use of double - make sound related functions take double for timing - inform people that the Jukebox sound player was renamed to SoundByte lol * make sound, input scheduling, and super curve use double precision * successfully load charts * editor works again v1 riqs can be saved and loaded * first tempo and volume markers are unmovable fix loading of charts' easing values * use gsync / freesync * update Jukebox refs to SoundByte * game events use double part 1 Air Rally - Glee Club converted * don't load song if chart load fails * finish conversion of all minigames * remove editor waveform toggle * timeline now respects added song offset length clear cache files on app close prepped notes for dsp sync * update timeline length when offset changed * update to latest Jukebox * make error panel object in global game manager * improve conductor music scheduling * added error message box fix first game events sometimes not playing
64 lines
2 KiB
C#
64 lines
2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using UnityEngine;
|
|
using NaughtyBezierCurves;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_DogNinja
|
|
{
|
|
public class SpawnHalves : MonoBehaviour
|
|
{
|
|
public double startBeat;
|
|
public Vector3 objPos;
|
|
private Vector3 posModifier;
|
|
public bool lefty;
|
|
float bpmModifier;
|
|
double songPos;
|
|
|
|
[SerializeField] float rotSpeed;
|
|
|
|
[Header("References")]
|
|
[SerializeField] BezierCurve3D fallLeftCurve;
|
|
[SerializeField] BezierCurve3D fallRightCurve;
|
|
BezierCurve3D curve;
|
|
[SerializeField] Transform halvesParent;
|
|
|
|
private DogNinja game;
|
|
|
|
private void Awake()
|
|
{
|
|
game = DogNinja.instance;
|
|
bpmModifier = Conductor.instance.songBpm / 100;
|
|
songPos = Conductor.instance.songPositionInBeatsAsDouble;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
curve = lefty ? fallRightCurve : fallLeftCurve;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
float flyPosHalves = (Conductor.instance.GetPositionFromBeat(songPos, 3f)*(Conductor.instance.GetPositionFromBeat(songPos, 2f)))+Conductor.instance.GetPositionFromBeat(songPos, 1f);
|
|
flyPosHalves = (flyPosHalves*0.2f)+0.35f;
|
|
transform.position = curve.GetPoint(flyPosHalves)+objPos;
|
|
|
|
float rot = rotSpeed;
|
|
rot *= lefty ? bpmModifier : -1 * bpmModifier;
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (rot * Time.deltaTime));
|
|
|
|
// clean-up logic
|
|
if (flyPosHalves > 1f) {
|
|
GameObject.Destroy(gameObject);
|
|
};
|
|
|
|
if ((!Conductor.instance.isPlaying && !Conductor.instance.isPaused)
|
|
|| GameManager.instance.currentGame != "dogNinja") {
|
|
GameObject.Destroy(gameObject);
|
|
};
|
|
}
|
|
}
|
|
}
|