Here what i’m trying to do is make the player finish the game as fast as he could to get good score.
So, I worked to make the game timer division the player score. But what i get are words “NaN” and “Infinity” inside total bar ?! here is my code.
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class gtime: MonoBehaviour {
public float GameTime;
public float seconds, minutes, hours;
public float division;
//
public float money = 5f;
public float stars = 8f;
public float total = 1f;
//
// Use this for initialization
void Start () {
GameTime = 0.0f;
}
// Update is called once per frame
void Update()
{
if (minutes >= 2 && hours == 0 ){
division = 2;
}
if (minutes >= 4 && hours == 0){
division = 3;
}
if (minutes >= 6 && hours == 0){
division = 4;
}
hours = (int)(GameTime / 3600.0f);
minutes = (int)(GameTime / 60f);
seconds = (int)(GameTime % 60f);
}
////
void count() {
total = (money + stars) / division;
}