DistanceBetweenCannonAndBullet









How do I use Distance Between Cannon And Bullet
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
198  void DistanceBetweenCannonAndBullet(){
199   GameObject[] bullet = GameObject.FindGameObjectsWithTag ("Player Bullet");
200   foreach (GameObject distanceToBullet in bullet) {
201    if (!distanceToBullet.transform.GetComponent ().isIdle) {
202     if (distanceToBullet.transform.position.x - player.position.x > distance) {
203      camera.isFollowing = true;
204      checkGameStatus = true;
205      timeSinceStartedShot = Time.time;
206      TimeSinceShot ();
207      camera.target = distanceToBullet.transform;
208     } else {
209      if(PlayerBullet() == 0){
210       camera.isFollowing = true;
211       checkGameStatus = true;
212       timeSinceStartedShot = Time.time;
213       TimeSinceShot ();
214       camera.target = distanceToBullet.transform;
215      }
216     }
217    }
218   }
219   /*if (GameObject.FindGameObjectWithTag ("Player Bullet") != null) {
220    if (!GameObject.FindGameObjectWithTag ("Player Bullet").transform.GetComponent ().isIdle) {
221     Transform distanceToBullet = GameObject.FindGameObjectWithTag ("Player Bullet").transform;
222     if (distanceToBullet.position.x - player.position.x > distance) {
223      camera.isFollowing = true;
224      checkGameStatus = true;
225      TimeSinceShot ();
226      camera.target = distanceToBullet;
227     }
228    }
229
230   }*/
231  }

DistanceBetweenCannonAndBullet 92 lượt xem

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