mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-15 22:25:07 +00:00
06f80bfb51
First Contact: Live is now offbeat [alienSuccess] code block is a bit smaller Mission Control is now stretchable Tap Trial - Started working on coding the inputs - Animated monkey (tap, double, and triple (incomplete))
57 lines
No EOL
1.5 KiB
C#
57 lines
No EOL
1.5 KiB
C#
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.StudioDance
|
|
{
|
|
public class Dancer : MonoBehaviour
|
|
{
|
|
private Animator animator;
|
|
private float lastReportedBeat = 0f;
|
|
private float currentBeat = 0f;
|
|
|
|
private bool isDance = false;
|
|
|
|
private void Start()
|
|
{
|
|
animator = GetComponent<Animator>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
var cond = Conductor.instance;
|
|
if (cond == null || !cond.isPlaying)
|
|
{
|
|
if (!isDance) return;
|
|
if (currentBeat % 2 != 0)
|
|
{
|
|
animator.DoScaledAnimationAsync("PoseL");
|
|
}
|
|
else
|
|
{
|
|
animator.DoScaledAnimationAsync("PoseR");
|
|
}
|
|
isDance = false;
|
|
return;
|
|
}
|
|
isDance = true;
|
|
|
|
if (cond.ReportBeat(ref lastReportedBeat))
|
|
{
|
|
currentBeat = lastReportedBeat;
|
|
}
|
|
else if (cond.songPositionInBeats < lastReportedBeat)
|
|
{
|
|
lastReportedBeat = Mathf.Round(cond.songPositionInBeats);
|
|
}
|
|
|
|
if (currentBeat % 2 != 0)
|
|
{
|
|
animator.DoScaledAnimation("DanceL", currentBeat);
|
|
}
|
|
else
|
|
{
|
|
animator.DoScaledAnimation("DanceR", currentBeat);
|
|
}
|
|
}
|
|
}
|
|
} |