Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Level : MonoBehaviour
- {
- float startTime;
- int numTreasures;
- int collected = 0;
- void Start()
- {
- startTime = Time.time;
- GameObject[] treasureObjects = GameObject.FindGameObjectsWithTag("Treasure");
- numTreasures = treasureObjects.Length;
- }
- void TreasureCollected()
- {
- collected++;
- }
- void OnGUI()
- {
- GUI.skin.label.fontSize = 20;
- GUI.Label(new Rect(10, 10, 200, 30), "Time: " + (Time.time - startTime).ToString("#.##"));
- GUI.Label(new Rect(10, 40, 200, 30), "Treasures: " + collected + "/" + numTreasures);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement