// Jimmy Vegas Unity Tutorials // This script is for your cube avoid start using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CM3D_Begins : MonoBehaviour { public GameObject thePlayer; public GameObject backMusic; public GameObject mainLogo; public GameObject gameLogo; public GameObject tapToBegin; public GameObject tapButton; public GameObject splashBackground; public GameObject countdownText; void Start() { StartCoroutine(StartupGame()); } IEnumerator StartupGame() { yield return new WaitForSeconds(1); mainLogo.SetActive(true); yield return new WaitForSeconds(2.5f); mainLogo.SetActive(false); gameLogo.SetActive(true); tapToBegin.SetActive(true); tapButton.SetActive(true); } public void TapToStart() { tapButton.SetActive(false); tapToBegin.SetActive(false); gameLogo.SetActive(false); splashBackground.GetComponent().Play("SplashFadeOut"); StartCoroutine(BeginTheGame()); } IEnumerator BeginTheGame() { yield return new WaitForSeconds(1); countdownText.SetActive(true); yield return new WaitForSeconds(1); countdownText.GetComponent().text = "2"; yield return new WaitForSeconds(1); countdownText.GetComponent().text = "1"; yield return new WaitForSeconds(1); countdownText.SetActive(false); countdownText.GetComponent().text = "3"; backMusic.SetActive(true); splashBackground.SetActive(false); thePlayer.GetComponent().enabled = true; } }