GameManagerScript
How do I use Game Manager Script
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PlayerMoveScript.cs
Copy
98 void OnCollisionEnter2D(Collision2D target) {
99 if(target.gameObject.tag == "died" || target.gameObject.tag == "Crates") {
100 jumpForce = 0;
101 scoreCount = 0;
102 anim.SetTrigger ("Died");
103 scoreText.gameObject.SetActive (false);
104 audioSource.PlayOneShot (diedClip);
105 FindObjectOfType
106 FindObjectOfType
107 FindObjectOfType
108 }
109 }
File name: PlayerMoveScript.cs
Copy
111 void OnTriggerEnter2D(Collider2D coin) {
112 if(coin.tag == "Coin") {
113 audioSource.PlayOneShot (coinClip);
114 coinScore++;
115 FindObjectOfType
116 coin.gameObject.SetActive (false);
117 }
118 }
File name: PlayerScript.cs
Copy
60 void OnCollisionEnter2D(Collision2D collider) {
61 if(collider.gameObject.tag == "FallingBlocks") {
62 GameManagerScript.instance.ifPlayerDied (score);
63 FindObjectOfType
64 }
65
66 }
File name: PlayerScript.cs
Copy
68 void OnTriggerEnter2D(Collider2D target) {
69 if (target.tag == "FallingBlocks") {
70 audioSource.PlayOneShot (pointClip);
71 score++;
72 GameManagerScript.instance.setScore (score);
73
74 }
75 }
Download file with original file name:GameManagerScript
GameManagerScript 110 lượt xem
Gõ tìm kiếm nhanh...