private void UpdateLevelStartVariables() { GrabPlayerSpawnPositions(); timedTorchesGO = GameObject.FindWithTag("TimedTorches"); doorsGO = GameObject.FindWithTag("Doors"); torches = new TorchSwitch[timedTorchesGO.transform.childCount]; for (int i = 0; i < timedTorchesGO.transform.childCount; i++) { torches[i] = timedTorchesGO.transform.GetChild(i).GetComponent <TorchSwitch>(); } torch = torches[0]; doors = new DoorSwitch[doorsGO.transform.childCount]; for (int i = 0; i < doorsGO.transform.childCount; i++) { doors[i] = doorsGO.transform.GetChild(i).GetComponent <DoorSwitch>(); } door = doors[1]; }
private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "LightRangeCollider") { // add both torch scripts to lists for later use TorchColor thisTorchColor = other.transform.parent.GetComponent <TorchColor>(); TorchSwitch thisTorchSwitch = other.transform.parent.GetComponent <TorchSwitch>(); torchesColor.Remove(thisTorchColor); torchesSwitch.Remove(thisTorchSwitch); } }
// Use this for initialization void Start() { timer = onTime; audioTimer = audioTimeBetweenTicks; torchSwitch = GetComponent <TorchSwitch>(); countDown = GameObject.FindWithTag("CountdownTimer").GetComponent <Text>(); countDown.text = ""; goal = transform.GetChild(3).GetComponent <TimedTorchGoal>(); torchSwitch.Off(); }
private void UpdateLevelStartVariables() { GrabPlayerSpawnPositions(); torchesGO = GameObject.FindWithTag("Torches"); doorsGO = GameObject.FindWithTag("Doors"); messagesGO = GameObject.FindWithTag("Messages"); torchesColor = new TorchColor[torchesGO.transform.childCount]; torches = new TorchSwitch[torchesGO.transform.childCount]; for (int i = 0; i < torchesGO.transform.childCount; i++) { torchesColor[i] = torchesGO.transform.GetChild(i).GetComponent <TorchColor>(); torches[i] = torchesGO.transform.GetChild(i).GetComponent <TorchSwitch>(); } torchSwitch16 = torches[2]; torchSwitch17 = torches[3]; torchColor16 = torchesColor[2]; torchColor17 = torchesColor[3]; doors = new DoorSwitch[doorsGO.transform.childCount]; for (int i = 0; i < doorsGO.transform.childCount; i++) { doors[i] = doorsGO.transform.GetChild(i).GetComponent <DoorSwitch>(); } door04 = doors[1]; door06 = doors[3]; messages = new RevealMessage[messagesGO.transform.childCount]; for (int i = 0; i < messagesGO.transform.childCount; i++) { messages[i] = messagesGO.transform.GetChild(i).GetComponent <RevealMessage>(); } message04a = messages[4]; message04b = messages[5]; message05a = messages[6]; message05b = messages[7]; message06a = messages[8]; message06b = messages[9]; }
private void Start() { float lightRange = 15f; lightRangeCollider = transform.GetChild(2).GetComponent <SphereCollider>(); flameLight.range = lightRange; lightRangeCollider.radius = lightRange; thisTorch = GetComponent <TorchSwitch>(); if (canChangeColour == true) { cage.SetActive(false); } changeSound = GetComponent <AudioSource>(); }
private void OnTriggerEnter(Collider other) { // collided with torch range collider if (other.gameObject.tag == "LightRangeCollider") { // add both torch scripts to lists for later use TorchColor thisTorchColor = other.transform.parent.GetComponent <TorchColor>(); TorchSwitch thisTorchSwitch = other.transform.parent.GetComponent <TorchSwitch>(); torchesColor.Add(thisTorchColor); torchesSwitch.Add(thisTorchSwitch); } // collided with torch range collider if (other.gameObject.tag == "LightRangeColliderBlock") { // add both torch scripts to lists for later use BlockLightColor thisBlockColor = other.transform.parent.GetComponent <BlockLightColor>(); blocksColor.Add(thisBlockColor); } }
// Use this for initialization void Start() { torchColorScript = transform.parent.GetComponent <TorchColor>(); torchSwitchScript = transform.parent.GetComponent <TorchSwitch>(); }