How would I have there be a counter to add totls without it continuously adding instead of stopping once the points are added from the last run
using UnityEngine;
using System.Collections;
public class playerprofile : MonoBehaviour {
public static int TotalScore = 0;
public static int TotalShots= 0;
public static int TotalEnemies = 0;
private int buttonWidth = 200;
private int buttonHeight = 50;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
TotalScore = player.Score + TotalScore;
TotalShots = player.ShotsFired + TotalShots;
TotalEnemies = player.EnemiesMissed + TotalEnemies;
}
void OnGUI()
{
BuildUI();
}
void BuildUI()
{
GUI.Label(new Rect(10, 10, 1200, 20), "Total Score: " + TotalScore.ToString());
GUI.Label(new Rect(10, 30, 1200, 20), "High Score: " + player.HighScore.ToString());
GUI.Label(new Rect(10, 50, 1200, 20), "Total Shots Fired: " + TotalShots.ToString());
GUI.Label(new Rect(10, 70, 1200, 20), "Total Enemies Killed: " + TotalEnemies.ToString());
}