HeavenStudioPlus/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs

43 lines
1 KiB
C#
Raw Normal View History

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