mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 12:57:40 +02:00
Quiz Show and Tambourine Reworks (#505)
* Tambourine fully reworked * quiz show rework part 1 * quiz show rework part 2 * oopsie doopsie * el fix numbah two
This commit is contained in:
30
Assets/Scripts/Games/QuizShow/QSTimer.cs
Normal file
30
Assets/Scripts/Games/QuizShow/QSTimer.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_QuizShow
|
||||
{
|
||||
public class QSTimer : MonoBehaviour
|
||||
{
|
||||
[Header("Components")]
|
||||
[SerializeField] private Transform timerTrans;
|
||||
|
||||
private double startBeat = double.MaxValue;
|
||||
private float length = 0;
|
||||
|
||||
public void Init(double beat, float interval)
|
||||
{
|
||||
startBeat = beat;
|
||||
length = interval;
|
||||
Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
float normalizedBeat = cond.GetPositionFromBeat(startBeat, length);
|
||||
if (normalizedBeat >= 0 && normalizedBeat <= 1) timerTrans.rotation = Quaternion.Euler(0, 0, normalizedBeat * -360);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user