BossDestroyed









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

Featured Snippets


File name: BossHealth.cs Copy
28  public void Health(int damage){
29   if (!invulnerable) {
30    if (!health.gameObject.activeInHierarchy) {
31     health.gameObject.SetActive (true);
32    }
33
34    if (health.value > 0) {
35     health.value -= damage;
36    }
37
38    if (health.value == 0) {
39     BossDestroyed ();
40    }
41   }
42  }
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  }

BossDestroyed 100 lượt xem

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