-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGUITextureLaunch.js
88 lines (68 loc) · 2.29 KB
/
GUITextureLaunch.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#pragma strict
//public var launchTexture : Texture2D;
var peakValue : float;
function Start () {
transform.position = Vector3.zero;
transform.localScale = Vector3.zero;
GetComponent.<GUITexture>().pixelInset = Rect (0, 0, Screen.width, Screen.height);
GetComponent.<GUITexture>().color.a = 0.0;
}
function FadeFlash(timer : float, fadeType : FadeDir) {
var start = fadeType == FadeDir.In? 0.0 : peakValue;
var end = fadeType == FadeDir.In? peakValue : 0.0;
var i = 0.0;
var step = 1.0/timer;
while (i <= 1.0) {
i += step * Time.deltaTime;
GetComponent.<GUITexture>().color.a = Mathf.Lerp(start, end, i);
yield;
}
}
function LinesFlash (timer : float, fadeType : FadeDir) {
var start = fadeType == FadeDir.In? GetComponent.<GUITexture>().color.a : peakValue;
var end = fadeType == FadeDir.In? peakValue : 0.0;
var i = 0.0;
var step = 1.0/timer;
// if (controllerITween2.speedingUp == 2) {
// if ((controllerITween2.speedingUp == 2) && (controllerITween2.Slowdown < 1)) {
while (i <= 1.0) {
i += step * Time.deltaTime;
GetComponent.<GUITexture>().color.a = Mathf.Lerp(start, end, i);
yield;
if (MoveController.Slowdown < 1) {break;}
}
yield WaitForSeconds (timer);
MoveController.speedingUp = 1;
// }
}
function LinesFlashOut (timer : float, fadeType : FadeDir) {
var start = fadeType == FadeDir.In? 0.0 : peakValue;
var end = fadeType == FadeDir.In? GetComponent.<GUITexture>().color.a : 0.0;
var i = 0.0;
var step = 1.0/timer;
if (MoveController.speedingUp == 0) {
while (i <= 1.0) {
i += step * Time.deltaTime;
GetComponent.<GUITexture>().color.a = Mathf.Lerp(end, start, i);
yield;
if (MoveController.Slowdown > 1) {break;}
}
yield WaitForSeconds (timer/3);
MoveController.speedingUp = 1;
}
}
function LinesOff () {
GetComponent.<GUITexture>().color.a = 0;
}
function FadeOut (timer : float) {
var start = GetComponent.<GUITexture>().color.a;
var end = 0.0;
var i = 0.0;
var step = 1.0/timer;
while (i <= 1.0) {
i += step * Time.deltaTime;
GetComponent.<GUITexture>().color.a = Mathf.Lerp(start, end, i);
yield;
}
yield WaitForSeconds (timer);
}