Officially first post on here so take it easy on me. I'm using a js to countdown (using 2 minutes). What I need is to store a 3 (for 3 stars) if they get it done in 1:40-1:50. Store a 2 (for 2 stars) if they get done in 1:50 to 2:00. And store a 1 (for 1 star) if they finish after 2:00. I would then use this value after the next level to display how many stars. I would also use this to unlock a secret level if 3 stars were acheived on all 5 levels. Code for Timer:
var startTime: float;
var timeRemaining:float;
function Start(){
startTime = 120.0;
guiText.material.color = Color.red;
}
function Update () {
Countdown();
}
function Countdown(){
timeRemaining = startTime - Time.time;
ShowTime();
if(timeRemaining < 0)
{
timeRemaining = 0;
TimeIsUp();
Debug.Log("Time remaining = "+ timeRemaining);
}
}
function ShowTime(){
var minutes: int;
var seconds: int;
var timeString : String;
minutes = timeRemaining/60;
seconds = timeRemaining%60;
timeString = minutes.ToString() +":" + seconds.ToString("D2");
guiText.text = timeString;
}
function TimeIsUp(){
Debug.Log("Time is up!");
}
Right now this works and displays "Time is up!" but I'm wanting it to store those values instead. I'm assuming using PlayerPrefs would be the best way. I also would like a way for my box collider to store a true value in PlayerPrefs so that I could use it for my level unlock screen. Any help is appriciated and I can post more code or info about my game if needed. Thanks