GameIsOnPlay









How do I use Game Is On Play
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: GameplayController.cs Copy
46  void Update () {
47   if (gameInProgress) {
48    GameIsOnPlay ();
49    DistanceBetweenCannonAndBullet ();
50   }
51
52
53   if(GameController.instance != null){
54    UpdateGameplayController ();
55   }
56
57  }
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  }

GameIsOnPlay 133 lượt xem

Gõ tìm kiếm nhanh...