Spawner









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

Featured Snippets


File name: Cloud.cs Copy
22  void Update () {
23   if (transform.position != target) {
24    transform.position = Vector3.MoveTowards (transform.position, target, speed * Time.deltaTime);
25   } else {
26    Destroy (gameObject);
27    GameplayController.instance.InitializeSpawners ();
28   }
29  }
File name: BossHealth.cs Copy
44  void BossDestroyed(){
45   Destroy (gameObject);
46   GameObject.FindGameObjectWithTag ("Spawner").transform.GetComponent ().active = true;
47   GameObject.FindGameObjectWithTag ("Spawner").transform.GetComponent ().isBossReady = false;
48   if(GameController.instance != null && MusicController.instance != null){
49    if(GameController.instance.isMusicOn){
50     MusicController.instance.audioSource.PlayOneShot (MusicController.instance.bossExplode);
51    }
52   }
53   Instantiate (explode, transform.position, Quaternion.identity);
54   for (int i = 0; i < 5; i++) {
55    Instantiate (coin, transform.position, Quaternion.identity);
56   }
57  }
File name: GameplayController.cs Copy
159  IEnumerator SpawnBossTime(){
160   warningText.gameObject.SetActive (true);
161   warningText.transform.GetComponent ().PlayWarning ();
162   yield return new WaitForSeconds (5f);
163   warningText.gameObject.SetActive (false);
164   warningText.transform.GetComponent ().StopWarning ();
165   GameObject.FindGameObjectWithTag ("Spawner").transform.GetComponent ().SpawnBoss ();
166  }
File name: GameplayController.cs Copy
221  public void RetryButton(){
222   InitializeGameplayVariables ();
223   ClearAllEnemies ();
224   gameInProgress = false;
225   GameObject.FindGameObjectWithTag ("Spawner").transform.GetComponent ().active = false;
226  }
File name: GameplayController.cs Copy
228  public void InitializeSpawners(){
229   GameObject.FindGameObjectWithTag ("Spawner").transform.GetComponent ().InitializeVariables ();
230   gameInProgress = true;
231  }

Download file with original file name:Spawner

Spawner 135 lượt xem

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