Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class RespectCounter : MonoBehaviour {
  6.  
  7.     private float score = 0.0f;
  8.  
  9.     public Text scoreText;
  10.     private bool isDead = false;
  11.     public DeathMenu deathMenu;
  12.  
  13.     // Use this for initialization
  14.     void Start () {
  15.    
  16.     }
  17.    
  18.     // Update is called once per frame
  19.     void Update () {
  20.  
  21.         if(isDead) {
  22.             return;
  23.         }
  24.  
  25.         score += Time.deltaTime;
  26.         scoreText.text = ((int)score).ToString();
  27.     }
  28.  
  29.     public void OnDeath() {
  30.         isDead = true;
  31.         deathMenu.ToggleEndScore (score);
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement