Subversion Repository Public Repository

Nextrek

Diff Revisions 116 vs 117 for /3DSpace/Assets/Custum/Scripts/CommunicationCenter.cs

Diff revisions: vs.
  @@ -47,6 +47,7 @@
47 47 for(int i=0;i<allies;i++)
48 48 {
49 49 Transform tp = Instantiate(allyPrefeb)as Transform;
50 + tp.tag = "Ally";
50 51 }
51 52 }
52 53 void LoadDataOfMission(int missionID)
  @@ -109,6 +110,7 @@
109 110 Debug.Log(e.Message);
110 111 }
111 112 }
113 +
112 114 void Update()
113 115 {
114 116 smallCameraShowTime-=Time.deltaTime;
  @@ -121,6 +123,7 @@
121 123 CheckTask();
122 124 }
123 125 }
126 +
124 127 public void DestroyOneEnemy(int id)
125 128 {
126 129 EnemyPool.Instance.DestroyOneEnemy(id);
  @@ -128,6 +131,7 @@
128 131 MessageWindow.Instance.NewMessage("An enemy ship has been destroyed!");
129 132 haveToKill--;
130 133 }
134 +
131 135 public void AllyDestroyOneEnemy(int id)
132 136 {
133 137 EnemyPool.Instance.DestroyOneEnemy(id);
  @@ -135,6 +139,7 @@
135 139 MessageWindow.Instance.NewMessage("An ally destroyed one enemy ship!");
136 140 haveToKill--;
137 141 }
142 +
138 143 public void ShowSmallCamera(bool show)
139 144 {
140 145 if(smallCamera.activeSelf!=show)
  @@ -146,8 +151,11 @@
146 151 smallCameraShowTime = 5;
147 152 }
148 153 }
154 +
149 155 void CheckTask()
150 156 {
157 + if (!EnemyPool.Instance) return;
158 +
151 159 if(EnemyPool.Instance.aliveEnemy<=0)
152 160 {
153 161 WinGame();
  @@ -169,6 +177,7 @@
169 177 return;
170 178 }
171 179 }
180 +
172 181 public void WinGame()
173 182 {
174 183 finished = true;
  @@ -176,6 +185,7 @@
176 185 ship.Finish();
177 186 GlobalObject.Instance.WinThisLevel(true);
178 187 }
188 +
179 189 public void FailGame()
180 190 {
181 191 finished = true;