RuntimePlatform









How do I use Runtime Platform
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PlayerController.cs Copy
31  void Update () {
32   if (GameplayController.instance.gameInProgress) {
33    LimitPosition ();
34    if (Application.platform == RuntimePlatform.WindowsEditor) {
35     PlayerMovement ();
36    }else if(Application.platform == RuntimePlatform.Android){
37     TouchMovement ();
38    }
39
40   }
41  }
File name: CameraFollow.cs Copy
30  void Update () {
31   if (GameplayController.instance.gameInProgress) {
32    if (isFollowing) {
33     if (GameObject.FindGameObjectWithTag ("Player Bullet") != null) {
34      MoveCameraFollow ();
35     }
36    } else {
37     if (!GameplayController.instance.player.GetChild (0).transform.GetComponent ().readyToShoot) {
38      MoveCameraBackToStart ();
39      AfterShotMoveAgain ();
40      allowToMove = false;
41     } else {
42      timeSinceShot = 0;
43      allowToMove = true;
44     }
45
46    }
47
48    if (Application.platform == RuntimePlatform.Android) {
49     TouchMoveCamera ();
50    } else if (Application.platform == RuntimePlatform.WindowsEditor) {
51     MoveCamera ();
52    }
53   }
54
55  }
File name: Cannon.cs Copy
43  void Update () {
44   if (GameplayController.instance.gameInProgress) {
45    if (readyToShoot) {
46     if(Application.platform == RuntimePlatform.Android){
47      TouchCannonShoot ();
48     }else if(Application.platform == RuntimePlatform.WindowsEditor){
49      CannonShoot ();
50     }
51
52    }
53
54    if(Application.platform == RuntimePlatform.Android){
55     TouchCannonMovement ();
56    }else if(Application.platform == RuntimePlatform.WindowsEditor){
57     CannonMovement ();
58    }
59
60   }
61  }

RuntimePlatform 125 lượt xem

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