mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:47:37 +02:00
f merge conflicts
This commit is contained in:
23
Assets/Scripts/LevelEditor/BPMText.cs
Normal file
23
Assets/Scripts/LevelEditor/BPMText.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
namespace RhythmHeavenMania.Editor
|
||||
{
|
||||
public class BPMText : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_Text BPM;
|
||||
[SerializeField] private TMP_Text BPMRounded;
|
||||
public void ChangeText(float timePressed)
|
||||
{
|
||||
float thisBPM = 60 / timePressed; // BPM = 60/t
|
||||
BPM.text = $"{thisBPM}";
|
||||
BPMRounded.text = $"{Mathf.RoundToInt(thisBPM)}";
|
||||
}
|
||||
public void ResetText()
|
||||
{
|
||||
BPM.text = "---";
|
||||
BPMRounded.text = "---";
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/LevelEditor/BPMText.cs.meta
Normal file
11
Assets/Scripts/LevelEditor/BPMText.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e85c112e06cd78440b6fe1fd894b9bba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
43
Assets/Scripts/LevelEditor/TempoFinder.cs
Normal file
43
Assets/Scripts/LevelEditor/TempoFinder.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RhythmHeavenMania.Editor
|
||||
{
|
||||
public class TempoFinder : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject tempoFinder;
|
||||
private bool pressed;
|
||||
private float timePressed;
|
||||
[SerializeField] private GameObject BPMText;
|
||||
private void Awake()
|
||||
{
|
||||
pressed = false;
|
||||
timePressed = 0f;
|
||||
}
|
||||
public void SwitchTempoDialog()
|
||||
{
|
||||
if(tempoFinder.activeSelf) {
|
||||
tempoFinder.SetActive(false);
|
||||
timePressed = 0;
|
||||
BPMText.GetComponent<BPMText>().ResetText();
|
||||
} else {
|
||||
tempoFinder.SetActive(true);
|
||||
}
|
||||
}
|
||||
public void TapBPM()
|
||||
{
|
||||
pressed = true;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
timePressed += Time.deltaTime;
|
||||
if(pressed)
|
||||
{
|
||||
pressed = false;
|
||||
BPMText.GetComponent<BPMText>().ChangeText(timePressed);
|
||||
timePressed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/LevelEditor/TempoFinder.cs.meta
Normal file
11
Assets/Scripts/LevelEditor/TempoFinder.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b489f3aef16a65499f9596abda39c35
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user