Skip to content

Instantly share code, notes, and snippets.

@Templar2020
Last active November 11, 2015 00:31
Show Gist options
  • Save Templar2020/e1f30d90e06854d6c440 to your computer and use it in GitHub Desktop.
Save Templar2020/e1f30d90e06854d6c440 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ScoreManager : MonoBehaviour {
public static int score;
Text text;
// Use this for initialization
void Start () {
text = GetComponent<Text>();
score = 0;
}
// Update is called once per frame
void Update () {
if (score < 0)
score = 0;
text.text = " " + score;
}
public static void AddPoints (int pointsToAdd) {
score += pointsToAdd;
}
public static void Reset () {
score=0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment