GameLost
How do I use Game Lost
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
125 | GameLost (); | 1 |
165 | void GameLost(){ | 2 |
File name: GameplayController.cs
Copy
88 void GameIsOnPlay(){
89 /*if (PlayerBullet () == 0) {
90 timeAfterLastShot += Time.deltaTime;
91 camera.isFollowing = false;
92 if (timeAfterLastShot > 2f) {
93 if (AllStopMoving () && AllEnemiesDestroyed ()) {
94 if (!gameFinished) {
95 gameFinished = true;
96 Debug.Log ("Hello World");
97 }
98 } else if (AllStopMoving () && !AllEnemiesDestroyed ()) {
99 if (!gameFinished) {
100 gameFinished = true;
101 Debug.Log ("Hi World");
102 }
103 }
104 }
105
106 }*/
107
108 if(checkGameStatus){
109 timeAfterLastShot += Time.deltaTime;
110 if (timeAfterLastShot > 2f) {
111 if (AllStopMoving () || Time.time - timeSinceStartedShot > 8f) {
112 if (AllEnemiesDestroyed ()) {
113 if (!gameFinished) {
114 gameFinished = true;
115 GameWin ();
116 timeAfterLastShot = 0;
117 checkGameStatus = false;
118 }
119 } else {
120 if (PlayerBullet () == 0) {
121 if (!gameFinished) {
122 gameFinished = true;
123 timeAfterLastShot = 0;
124 checkGameStatus = false;
125 GameLost ();
126 }
127 } else {
128 checkGameStatus = false;
129 camera.isFollowing = false;
130 timeAfterLastShot = 0;
131 }
132 }
133 }
134 }
135
136 }
137
138 }
File name: GameplayController.cs
Copy
165 void GameLost(){
166 if(GameController.instance != null && MusicController.instance != null){
167 if(GameController.instance.isMusicOn){
168 AudioSource.PlayClipAtPoint (MusicController.instance.loseSound, Camera.main.transform.position);
169 }
170 }
171 gameOverPanel.SetActive (true);
172 }
GameLost 151 lượt xem
Gõ tìm kiếm nhanh...