-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlightSystem.cs
More file actions
119 lines (82 loc) · 3.1 KB
/
Copy pathlightSystem.cs
File metadata and controls
119 lines (82 loc) · 3.1 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using UnityEngine;
using System.Collections;
public class lightSystem : MonoBehaviour {
public GameObject onPlay;
public GameObject onPlay2;
public GameObject frontLight;
public GameObject redLight;
public GameObject greenLight;
public GameObject blueLight;
public GameObject machineLight;
public float timer;
public float waitingTime;
public GameObject people;
// Use this for initialization
void Start () {
frontLight = GameObject.Find ("FrontLight");
redLight = GameObject.Find("redLight");
blueLight = GameObject.Find ("blueLight");
greenLight = GameObject.Find ("greenLight");
machineLight = GameObject.Find ("machineLight");
onPlay = GameObject.Find ("track1");
onPlay2 = GameObject.Find ("track2");
people = GameObject.Find ("people");
timer = 0.0f;
waitingTime = 2.0f;
Vector3 temp = new Vector3 (50000.0f, 0, 0); //rgb삼인방 시작되면 우주로 날림
if (redLight.GetComponent<Transform> ().position.x < 30000.0f) {
redLight.GetComponent<Transform> ().position += temp;
}
if (greenLight.GetComponent<Transform> ().position.x < 30000.0f) {
greenLight.GetComponent<Transform> ().position += temp;
}
if (blueLight.GetComponent<Transform> ().position.x < 30000.0f) {
blueLight.GetComponent<Transform> ().position += temp;
}
if (machineLight.GetComponent<Transform> ().position.x < 30000.0f) {
machineLight.GetComponent<Transform> ().position += temp;
}
}
// Update is called once per frame
void Update () {
Vector3 temp = new Vector3 (50000.0f, 0, 0);
onPlay = GameObject.Find ("track1");
onPlay2 = GameObject.Find ("track2");
people = GameObject.Find ("people");
timer += Time.deltaTime;
if (people.GetComponent<AudioSource> ().isPlaying == false) {
// 오른쪽끝으로 바떙기면 일어나는
}
if (onPlay.GetComponent<AudioSource> ().isPlaying==true) {
//시간에 따른 이벤트처리
if (timer >= waitingTime&& timer<waitingTime*2.0f) {
if (greenLight.GetComponent<Transform> ().position.x < 30000.0f) {
greenLight.GetComponent<Transform> ().position += temp;
}//greenlight를 끕니다.
if (redLight.GetComponent<Transform> ().position.x >= 30000.0f) {
redLight.GetComponent<Transform> ().position -= temp;
}//redlight를 켭니다.
}
else if(timer>= waitingTime*2.0f &&timer<waitingTime*4.0f){
if (redLight.GetComponent<Transform> ().position.x < 30000.0f) {
redLight.GetComponent<Transform> ().position += temp;
}//redlight를 끕니다.
if (blueLight.GetComponent<Transform> ().position.x >= 30000.0f) {
blueLight.GetComponent<Transform> ().position -= temp;
}//bluelight를 켭니다.
}
else if(timer>= waitingTime*4.0f &&timer<waitingTime*6.0f){
if (blueLight.GetComponent<Transform> ().position.x < 30000.0f) {
blueLight.GetComponent<Transform> ().position += temp;
}//bluelight를 끕니다.
if (greenLight.GetComponent<Transform> ().position.x >= 30000.0f) {
greenLight.GetComponent<Transform> ().position -= temp;
}//greenlight를 켭니다.
}
if(timer>=12.0f)
{
timer =0;
}
}
}
}