private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "LevelOneLight") { if (other.gameObject == TargetOne) { SpotOne.SetActive(false); TargetOne.SetActive(false); colorState |= Helper.ColorStates.HasRed; if (colorState.HasFlag(Helper.ColorStates.HasBlue)) { BaseLight.GetComponent <Light>().color = new Color(1, 0, 1); } else { BaseLight.GetComponent <Light>().color = new Color(1, 0, 0); } } if (other.gameObject == TargetTwo) { SpotTwo.SetActive(false); TargetTwo.SetActive(false); colorState |= Helper.ColorStates.HasBlue; if (colorState.HasFlag(Helper.ColorStates.HasRed)) { BaseLight.GetComponent <Light>().color = new Color(1, 0, 1); } else { BaseLight.GetComponent <Light>().color = new Color(0, 0, 1); } } } else if (other.gameObject.tag == "LevelTrigger") { if (other.gameObject == LevelOneStartTrigger) { Startup(); } if (other.gameObject == LevelOneEndTrigger) { Shutdown(); } } }
public void ResetColorState() { colorState = 0; }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "LevelOneLight") { if (other.gameObject == TargetOne) { colorState |= Helper.ColorStates.HasRed; if (colorState.HasFlag(Helper.ColorStates.HasGreen | Helper.ColorStates.HasBlue)) { BaseLight.GetComponent <Light>().color = Color.white; colorState = 0; } else if (colorState.HasFlag(Helper.ColorStates.HasGreen)) { BaseLight.GetComponent <Light>().color = Color.yellow; } else if (colorState.HasFlag(Helper.ColorStates.HasBlue)) { BaseLight.GetComponent <Light>().color = Color.magenta; } else { BaseLight.GetComponent <Light>().color = Color.red; } } else if (other.gameObject == TargetTwo) { colorState |= Helper.ColorStates.HasGreen; if (colorState.HasFlag(Helper.ColorStates.HasRed | Helper.ColorStates.HasBlue)) { BaseLight.GetComponent <Light>().color = Color.white; colorState = 0; } else if (colorState.HasFlag(Helper.ColorStates.HasRed)) { BaseLight.GetComponent <Light>().color = Color.yellow; } else if (colorState.HasFlag(Helper.ColorStates.HasBlue)) { BaseLight.GetComponent <Light>().color = Color.cyan; } else { BaseLight.GetComponent <Light>().color = Color.green; } } else if (other.gameObject == TargetThree) { colorState |= Helper.ColorStates.HasBlue; if (colorState.HasFlag(Helper.ColorStates.HasGreen | Helper.ColorStates.HasRed)) { BaseLight.GetComponent <Light>().color = Color.white; colorState = 0; } else if (colorState.HasFlag(Helper.ColorStates.HasGreen)) { BaseLight.GetComponent <Light>().color = Color.cyan; } else if (colorState.HasFlag(Helper.ColorStates.HasRed)) { BaseLight.GetComponent <Light>().color = Color.magenta; } else { BaseLight.GetComponent <Light>().color = Color.blue; } } } else if (other.gameObject.tag == "LevelTrigger") { if (other.gameObject == LevelTwoStartTrigger) { Startup(); } if (other.gameObject == LevelTwoEndTrigger) { Shutdown(); } } }