I have a scoring system put in place with triggers setup on my prefabs (obstacles) the player has to run through. It works, but the player still scores if they hit the obstacle. Any ideas on how to stop the scoring if they hit the obstacle? Also i want the score to multiply after a certain amount of times without hitting an obstacle. Here is what i have so far.
public static int playerScore = 0; //This is the player's score.
public int oScore = 10;
private GameObject scoreText;
// Use this for initialization
void Start () {
scoreText = GameObject.Find("scoreNumber");
}
//COLLISIONS
void OnTriggerEnter(Collider col)
{
//If we collide with a trigger, increase player's score.
if(col.gameObject.name == "Pointgiver")
{
Destroy(col.gameObject);
playerScore += oScore;
}
}
void OnGUI()
{
scoreText.guiText.text = playerScore.ToString();
}
}