Hi, I’m new to Unity3d and I’m working on my first project to get to know the software and learn C#. I’m trying to make an upgrade system with points. I have a score variable (int) which is increased by 50 every time you kill an enemy and each time you have 1000 score I would like another variable (int uPoints) to be increased by 1.
The tricky part here is that when you die 3 times you are game over so score resets but i wan uPoints to keep it’s value. Anyone can help me with this please? Here’s my score script, it just need the uPoints line(s) of code:
using UnityEngine;
using System.Collections;
public class Score : MonoBehaviour {
public static int score = 0;
public static int uPoints = 0;
void OnTriggerEnter(Collider collider){
if(collider.gameObject.CompareTag ("Enemy")){
score += 50;
Destroy(this.gameObject);
}
}
}
Thanks!