We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6fa39e commit f9d5c7dCopy full SHA for f9d5c7d
Light_Flirking
@@ -0,0 +1,28 @@
1
+using System.Collections;
2
+using System.Collections.Generic;
3
+using UnityEngine;
4
+
5
+public class Light_Flirking : MonoBehaviour
6
+{
7
+ public bool IsFlickering = false;
8
+ public float timeDelay;
9
10
+ void Update()
11
+ {
12
+ if (IsFlickering == false)
13
14
+ StartCoroutine(FlirkingLight());
15
+ }
16
17
+ IEnumerator FlirkingLight()
18
19
+ IsFlickering = true;
20
+ this.gameObject.GetComponent<Light>().enabled = false;
21
+ timeDelay = Random.Range(0.01f, 0.1f);
22
+ yield return new WaitForSeconds(timeDelay);
23
+ this.gameObject.GetComponent<Light>().enabled = true;
24
25
26
+ IsFlickering = false;
27
28
+}
0 commit comments