forked from adenlb/Vivid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
#flash.cs#
35 lines (30 loc) · 1.12 KB
/
#flash.cs#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using UnityEngine;
using System.Collections;
public class flash : MonoBehaviour {
private Color sentinel;
public bool flashing;
public Light flashLight;
void Start () {
flashLight.range = 0;
flashLight.intensity = 8;
flashLight.bounceIntensity = 8;
flashing = false;
sentinel = Color.gray;
flashLight.color = sentinel;
}
public void initFlash (Color c) {
flashing = true;
flashLight.color = c;
flashLight.range = 0;
}
// Update is called once per frame
void Update () {
if (flashing) {
flashLight.range += 10;
if (flashLight.range >= 100) {
flashing = false;
flashLight.range = 0;
}
}
}
}