mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:27:39 +02:00
fully functional snap change menu
This commit is contained in:
43
Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs
Normal file
43
Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class TempoFinder : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject tempoFinder;
|
||||
private bool pressed;
|
||||
private float timePressed;
|
||||
[SerializeField] private BPMText bpmText;
|
||||
private void Awake()
|
||||
{
|
||||
pressed = false;
|
||||
timePressed = 0f;
|
||||
}
|
||||
public void SwitchTempoDialog()
|
||||
{
|
||||
if(tempoFinder.activeSelf) {
|
||||
tempoFinder.SetActive(false);
|
||||
timePressed = 0;
|
||||
bpmText.ResetText();
|
||||
} else {
|
||||
tempoFinder.SetActive(true);
|
||||
}
|
||||
}
|
||||
public void TapBPM()
|
||||
{
|
||||
pressed = true;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
timePressed += Time.deltaTime;
|
||||
if(pressed)
|
||||
{
|
||||
pressed = false;
|
||||
bpmText.ChangeText(timePressed);
|
||||
timePressed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user