HeavenStudioPlus/Assets/Scripts/Games/DoubleDate/DoubleDateWeasels.cs
minenice55 bb2ae74339
Integration of Jukebox Library (#451)
* 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
2023-06-10 15:13:29 -04:00

96 lines
2.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_DoubleDate
{
public class DoubleDateWeasels : MonoBehaviour
{
bool canBop = true;
Animator anim;
private DoubleDate game;
bool notHit = true;
float lastGacha = float.MinValue;
void Awake()
{
game = DoubleDate.instance;
anim = GetComponent<Animator>();
}
public void Bop()
{
if (canBop && notHit && Conductor.instance.songPositionInBeats > lastGacha)
{
anim.DoScaledAnimationAsync("WeaselsBop", 0.5f);
}
}
public void Happy()
{
if (notHit && Conductor.instance.songPositionInBeats > lastGacha)
anim.DoScaledAnimationAsync("WeaselsHappy", 0.5f);
}
public void Jump()
{
if (notHit && Conductor.instance.songPositionInBeats > lastGacha)
{
lastGacha = Conductor.instance.songPositionInBeats + 1f;
anim.DoScaledAnimationAsync("WeaselsJump", 0.5f);
}
}
public void Hide(double beat)
{
if (notHit)
{
notHit = false;
anim.DoScaledAnimationAsync("WeaselsHide", 0.5f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1.45f, delegate
{
lastGacha = Conductor.instance.songPositionInBeats + 0.5f;
anim.DoScaledAnimationAsync("WeaselsAppearUpset", 0.5f);
notHit = true;
}),
});
}
}
public void Surprise()
{
if (notHit && Conductor.instance.songPositionInBeats > lastGacha)
{
lastGacha = Conductor.instance.songPositionInBeats + 0.5f;
anim.DoScaledAnimationAsync("WeaselsSurprised", 0.5f);
}
}
public void Hit(double beat)
{
if (notHit)
{
notHit = false;
anim.DoScaledAnimationAsync("WeaselsHit", 0.5f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate
{
lastGacha = Conductor.instance.songPositionInBeats + 0.5f;
anim.DoScaledAnimationAsync("WeaselsAppearUpset", 1f);
notHit = true;
}),
});
}
}
public void ToggleBop()
{
canBop = !canBop;
}
}
}