mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 21:55:09 +00:00
afc665ed61
* 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
120 lines
4.2 KiB
C#
120 lines
4.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
using System;
|
|
|
|
namespace HeavenStudio.Games.Scripts_TossBoys
|
|
{
|
|
public class TossBoysBall : SuperCurveObject
|
|
{
|
|
public enum State
|
|
{
|
|
None,
|
|
RedDispense,
|
|
BlueDispense,
|
|
YellowDispense,
|
|
RedBlue,
|
|
RedYellow,
|
|
BlueRed,
|
|
BlueYellow,
|
|
YellowRed,
|
|
YellowBlue,
|
|
RedBlueDual,
|
|
RedYellowDual,
|
|
BlueRedDual,
|
|
BlueYellowDual,
|
|
YellowRedDual,
|
|
YellowBlueDual,
|
|
RedBlueHigh,
|
|
RedYellowHigh,
|
|
BlueRedHigh,
|
|
BlueYellowHigh,
|
|
YellowRedHigh,
|
|
YellowBlueHigh,
|
|
RedBlur,
|
|
RedKeep,
|
|
BlueBlur,
|
|
BlueKeep,
|
|
YellowBlur,
|
|
YellowKeep
|
|
}
|
|
|
|
private State currentState;
|
|
|
|
private double startBeat;
|
|
|
|
private Path currentPath;
|
|
|
|
private TossBoys game;
|
|
|
|
[NonSerialized] public Animator anim;
|
|
|
|
private void Awake()
|
|
{
|
|
game = TossBoys.instance;
|
|
anim = GetComponent<Animator>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused)
|
|
{
|
|
switch (currentState)
|
|
{
|
|
case State.None:
|
|
//Do Jackshit
|
|
break;
|
|
default:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, Conductor.instance.songPositionInBeatsAsDouble), startBeat);
|
|
float rot = GetPathValue("rot");
|
|
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f / Conductor.instance.pitchedSecPerBeat)));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetState(State state, double beat, float length = 0)
|
|
{
|
|
UpdateLastRealPos();
|
|
startBeat = beat;
|
|
currentState = state;
|
|
currentPath = currentState switch
|
|
{
|
|
State.None => new Path(),
|
|
State.RedDispense => game.GetPath("RedDispense"),
|
|
State.BlueDispense => game.GetPath("BlueDispense"),
|
|
State.YellowDispense => game.GetPath("YellowDispense"),
|
|
State.RedBlue => game.GetPath("RedBlue"),
|
|
State.RedYellow => game.GetPath("RedYellow"),
|
|
State.BlueRed => game.GetPath("BlueRed"),
|
|
State.BlueYellow => game.GetPath("BlueYellow"),
|
|
State.YellowRed => game.GetPath("YellowRed"),
|
|
State.YellowBlue => game.GetPath("YellowBlue"),
|
|
State.RedBlueDual => game.GetPath("RedBlueDual"),
|
|
State.RedYellowDual => game.GetPath("RedYellowDual"),
|
|
State.BlueRedDual => game.GetPath("BlueRedDual"),
|
|
State.BlueYellowDual => game.GetPath("BlueYellowDual"),
|
|
State.YellowRedDual => game.GetPath("YellowRedDual"),
|
|
State.YellowBlueDual => game.GetPath("YellowBlueDual"),
|
|
State.RedBlueHigh => game.GetPath("RedBlueHigh"),
|
|
State.RedYellowHigh => game.GetPath("RedYellowHigh"),
|
|
State.BlueRedHigh => game.GetPath("BlueRedHigh"),
|
|
State.BlueYellowHigh => game.GetPath("BlueYellowHigh"),
|
|
State.YellowRedHigh => game.GetPath("YellowRedHigh"),
|
|
State.YellowBlueHigh => game.GetPath("YellowBlueHigh"),
|
|
State.RedBlur => game.GetPath("RedBlur"),
|
|
State.RedKeep => game.GetPath("RedKeep"),
|
|
State.BlueBlur => game.GetPath("BlueBlur"),
|
|
State.BlueKeep => game.GetPath("BlueKeep"),
|
|
State.YellowBlur => game.GetPath("YellowBlur"),
|
|
State.YellowKeep => game.GetPath("YellowKeep"),
|
|
_ => throw new System.NotImplementedException()
|
|
};
|
|
if (length != 0)
|
|
{
|
|
currentPath.positions[0].duration = length;
|
|
}
|
|
}
|
|
}
|
|
}
|