HeavenStudio/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs
minenice55 2b4b7f0a73 make all dialogs inherit one base class
- opening a new dialog closes the previous one
2022-08-26 23:43:01 -04:00

43 lines
1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HeavenStudio.Editor
{
public class TempoFinder : Dialog
{
private bool pressed;
private float timePressed;
[SerializeField] private BPMText bpmText;
private void Awake()
{
pressed = false;
timePressed = 0f;
}
public void SwitchTempoDialog()
{
if(dialog.activeSelf) {
dialog.SetActive(false);
timePressed = 0;
bpmText.ResetText();
} else {
ResetAllDialogs();
dialog.SetActive(true);
}
}
public void TapBPM()
{
pressed = true;
}
private void Update()
{
timePressed += Time.deltaTime;
if(pressed)
{
pressed = false;
bpmText.ChangeText(timePressed);
timePressed = 0;
}
}
}
}