//Jimmy Vegas Unity Tutorial //These scripts will set your modes using System.Collections; using System.Collections.Generic; using UnityEngine; public class ModeSelect : MonoBehaviour { public static int RaceMode; // 0=Race, 1=Score, 2=Time public void ScoreMode () { RaceMode = 1; } public void TimeMode() { RaceMode = 2; } } using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ModeScore : MonoBehaviour { public int ModeSelection; public GameObject RaceUI; public GameObject ScoreUI; public GameObject AICar; public static int CurrentScore; public int InternalScore; public GameObject ScoreValue; public GameObject ScoreObjects; void Start () { ModeSelection = ModeSelect.RaceMode; if (ModeSelection == 1) { RaceUI.SetActive(false); ScoreUI.SetActive(true); AICar.SetActive(false); ScoreObjects.SetActive(true); } } void Update() { InternalScore = CurrentScore; ScoreValue.GetComponent().text = "" + InternalScore; } } using System.Collections; using System.Collections.Generic; using UnityEngine; public class RedScore : MonoBehaviour { void OnTriggerEnter() { ModeScore.CurrentScore += 100; gameObject.SetActive(false); } } using System.Collections; using System.Collections.Generic; using UnityEngine; public class BlueScore : MonoBehaviour { void OnTriggerEnter() { ModeScore.CurrentScore += 50; gameObject.SetActive(false); } } using System.Collections; using System.Collections.Generic; using UnityEngine; public class YellowScore : MonoBehaviour { void OnTriggerEnter() { ModeScore.CurrentScore += 25; gameObject.SetActive(false); } }