mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:47:37 +02:00
add cursor toggle, master volume
This commit is contained in:
57
Assets/Scripts/StudioDance/Dancer.cs
Normal file
57
Assets/Scripts/StudioDance/Dancer.cs
Normal file
@ -0,0 +1,57 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/StudioDance/Dancer.cs.meta
Normal file
11
Assets/Scripts/StudioDance/Dancer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e57f95bd19852bc46a88eb6f67404fce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Scripts/StudioDance/StudioDanceManager.cs
Normal file
26
Assets/Scripts/StudioDance/StudioDanceManager.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio;
|
||||
|
||||
namespace HeavenStudio.StudioDance
|
||||
{
|
||||
public class StudioDanceManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject windowBase;
|
||||
[SerializeField] private Transform windowHolder;
|
||||
[SerializeField] private GameObject content;
|
||||
|
||||
public void OpenDanceWindow()
|
||||
{
|
||||
var mobj = GameObject.Instantiate(windowBase, windowHolder);
|
||||
mobj.SetActive(true);
|
||||
content.SetActive(true);
|
||||
}
|
||||
|
||||
public void CloseDanceWindow()
|
||||
{
|
||||
content.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/StudioDance/StudioDanceManager.cs.meta
Normal file
11
Assets/Scripts/StudioDance/StudioDanceManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f906c9e16af974d409dd19d0836bb9c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user