Advertisement
Beg_Productions

ScoreManger

Oct 11th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class ScoreManager : MonoBehaviour {
  6.  
  7.     public static int score;
  8.  
  9.     Text text;
  10.  
  11.     void Start ()
  12.     {
  13.         text = GetComponent <Text> ();
  14.  
  15.         score = 0;
  16.     }
  17.  
  18.     void Update ()
  19.     {
  20.         if (score < 0)
  21.             score = 0;
  22.        
  23.         text.text = "" + score;
  24.     }
  25.        
  26.     public static void AddPoints (int PointsToAdd)
  27.     {
  28.         score += PointsToAdd;
  29.     }
  30.  
  31.     public static void Reset()
  32.     {
  33.         score = 0;
  34.     }
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement