This is my script. I want to wait a few seconds before loading the level but still display the message while waiting (down in the bottom)
public class PlayerController : MonoBehaviour {
public float speed;
public Text countText;
public Text winText;
private Rigidbody rb;
private int count;
void Start ()
{
rb = GetComponent<Rigidbody>();
count = 0;
SetCountText ();
winText.text = "";
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
void Update ()
{
if (Input.GetKey ("escape")) {
Application.LoadLevel (0);
}
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ("Pick Up")) {
other.gameObject.SetActive (false);
count = count + 1;
SetCountText();
}
}
void SetCountText ()
{
countText.text = "Coins: " + count.ToString ();
if (count >= 12)
{
winText.text = "Nice!";
Application.LoadLevel(0);
}
}
}