public GameObject screenErrorMessage; //The error UI text // Use this for initialization void Start() { //These IF statements ensure that when the game starts up, these variables are assigned with their respective components and game objects. if (anim == null) { anim = GetComponent <Animator>(); } if (timer == null) { timer = GameObject.Find("GameManager").GetComponent <Timer>(); } if (countCompInstall == null) { countCompInstall = GameObject.Find("GameManager").GetComponent <CountingComponentInstallation>(); } //Turn off UI text for monitor at start of game screenOnMessage.SetActive(false); screenErrorMessage.SetActive(false); //By default a blank screen should be displayed on the monitor to show it is turned off monitorScreen.sprite = screenOff; endTimerUI.text = ""; //Clear the endTimerUI text at the start of the game }
//Use this for initialization void Start() { //These IF statements makes sure the references to each component and script is assigned to their respective variables if (playerControls == null) { playerControls = GameObject.Find("WandCube").GetComponent <PlayerControls>();; } if (socketTransform == null) { socketTransform = gameObject.transform.Find("Node"); //Each socket should have a game object called node, where the component will be attached to, this simulates the component being installed in the socket } if (countCompInstall == null) { countCompInstall = GameObject.Find("GameManager").GetComponent <CountingComponentInstallation>(); } }