// Update is called once per frame void Update() { for (int i = 0; i < flickeringLights.Count; ++i) { FlickeringLight light = flickeringLights[i]; //Debug.Log(string.Format("Light Info: {0} time on: {1:F4} time off: {2:F4}", light.light.enabled, light.time_on, light.time_off)); if (light.light.enabled) { light.time_on -= Time.deltaTime; if (light.time_on < 0) { light.light.enabled = false; light.time_on = Random.Range(minTime, maxTime); } } else { light.time_off -= Time.deltaTime; if (light.time_off < 0) { light.light.enabled = true; light.time_off = Random.Range(minTime, maxTime); } } //Debug.Log(string.Format("Light Info after: {0} time on: {1:F4} time off: {2:F4}", light.light.enabled, light.time_on, light.time_off)); flickeringLights[i] = light; } }
// Use this for initialization void Start() { brightness = gameObject.transform.GetComponentInChildren <Light>(); flame = gameObject.transform.GetComponentInChildren <ParticleSystem>(); flicker = gameObject.transform.GetComponentInChildren <FlickeringLight>(); candle = transform.GetChild(0); }
// Start is called before the first frame update void Start() { flickeringLights = new List <FlickeringLight>(); foreach (Light light in lights) { FlickeringLight fl = new FlickeringLight(light, Random.Range(minTime, maxTime), Random.Range(minTime, maxTime)); flickeringLights.Add(fl); } }
private void OnTriggerEnter(Collider other) { FlickeringLight fg = other.gameObject.GetComponent <FlickeringLight>(); if (fg = null) { return; } fg.onmat(); }
void Start() { _canMove = true; GameManager.Instance._inDungeon = true; _origPos = transform.localPosition; //Cursor.lockState = CursorLockMode.None; AudioManager.Instance.PlayMusic(_musicToPlay); UpdateCompass(); yellowFlickeringLight = _heldLightYellow.GetComponent <FlickeringLight>(); blueFlickeringLight = _heldLightBlue.GetComponent <FlickeringLight>(); }