My game is a round maze where you need to roll the ball to the center. I need three score parameters:
-
How many times overall player succesfully rolled the ball to the center.
-
Fastest time
-
How many times player rolled the ball to the center,only with time less than 3 seconds, IN A ROW.
-
My code for first parameter
public class Reset2 : MonoBehaviour {
public GUIText Score; /i dragged specific GUIText object in/ private int Point;
void Start () {
/something/}
void Update () {
if /something/ { /reload level/ Point = 1; Score.text="0" + Point; } }
}
First i need, is to show in my dragged specific GUIText object, how many times player rolled the ball to the center ( “if /something/” means that player sucessfully did it ). So GUIText, that shows it and start with “0”, need to +1 every time “if /something/” triggers. But i am not sure what to change in my code, because it doesn’t seem to work.
- Fastest time. I’ve founded “Time.timeSinceLevelLoad” , but i am not sure how it works and should i use it or not? I need the time from the start of every session ( level ), to the end ( when the ball reachs the center, the “if/something/” part), and in case if the new time is better, it must replace GUIText for fastest time with a new record.
I guess for 2) i need to start timer counting in “Void Start” part, and in “Void Update” part i need to write something like “If new time < Record, /then/ GUIText.text = new time;”
- Using “Time.timeSinceLevelLoad” for example, i want to record how many times IN A ROW, player succesfully rolled the ball to the center with time less than 3 seconds.
i guess i need to write in “Update part” something like
if player’s time < 3 seconds then somehow set GUIText.text =“1”;
if player’s time is again < 3 seconds then set somehow GUIText.text=“2”;
if player’s time is AGAIN < 3 seconds then set to 3 and etc. etc.
maybe even loop it somehow with increasing number
So, any idea how to make it right?