hello!
when my player hits an obstacle i need it to subtract points from the initial number of points that there are.
This is the script i have so far, it is attached to the obstacles. The problem is that it skips over the ontriggerenter method.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class TriggerScore : MonoBehaviour {
// Use this for initialization
public static int score = 24;
GameObject horse;
// gameController;
void Start ()
{
//gameController = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController>();
horse = GameObject.Find("Horse");
}
void OnTriggerEnter (Collider col)
{
if (col.tag.Equals("Horse"))
{
score -= 3;
for(int i=3;i>0;i--)
{
horse.GetComponent<MovementController>().speedOfHorse=4;
}
horse.GetComponent<MovementController>().speedOfHorse=5;
}
}
}