Bit of cleanup

This commit is contained in:
lvrossem
2023-03-02 17:13:57 +01:00
parent 0abf2096e8
commit 630c94836f
3 changed files with 4 additions and 47 deletions

View File

@@ -57,8 +57,7 @@ public class SpellingBeeController : MonoBehaviour {
timerValue -= Time.deltaTime;
if (timerValue <= 0.0f)
{
if (timerValue <= 0.0f) {
timerValue = 0.0f;
// Handle end of timer
}
@@ -69,6 +68,7 @@ public class SpellingBeeController : MonoBehaviour {
timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
}
// Check if the correct char has been given as input
void checkChar(char letter) {
if (Char.ToUpper(letter) == Char.ToUpper(currentWord[currentIndex]) && input.text.Length == 1) {
letters[currentIndex].GetComponent<Image>().color = Color.green;
@@ -86,10 +86,12 @@ public class SpellingBeeController : MonoBehaviour {
}
}
// Adds seconds to timer
void addSeconds(int seconds) {
timerValue += (float) seconds;
}
// Find the chosen theme by its name
Theme findThemeByName(string themeName) {
int themeIndex = 0;

View File

@@ -1,34 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
public class Timer : MonoBehaviour
{
private float timerValue;
public Text timerText;
void Start()
{
timerValue = 0.0f;
timerText = GetComponent<Text>();
}
void Update()
{
timerValue -= Time.deltaTime;
if (timerValue <= 0.0f)
{
timerValue = 0.0f;
// Handle end of timer
}
int minutes = Mathf.FloorToInt(timerValue / 60.0f);
int seconds = Mathf.FloorToInt(timerValue % 60.0f);
timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
}
void addSeconds(int seconds) {
timerValue += (float) seconds;
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 531e5c20048e1923fa3ed13005bd4a0b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: