コード例 #1
0
 void Update()
 {
     if (HealthBarBoss.GetHealthBarValue() <= 0)
     {
         youWin.enabled = true;
         Destroy(gameObject);
         SceneManager.LoadScene("Scene1");
     }
 }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     Health             = MaxHealth;
     player             = GameObject.FindObjectOfType(typeof(Player)) as Player;
     cameraShake        = GameObject.FindObjectOfType(typeof(CameraShake)) as CameraShake;
     wallTrigger        = GameObject.FindObjectOfType(typeof(WallTrigger)) as WallTrigger;
     HealthBar          = FindObjectOfType <HealthBarBoss>();
     origWallPosition.x = Wall.transform.position.x;
     origWallPosition.y = Wall.transform.position.y;
     //StartCoroutine("boss");
 }
コード例 #3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Wall")
     {
         Destroy(this.gameObject);
     }
     if (collision.gameObject.tag == "Enemy")
     {
         Destroy(this.gameObject);
         Destroy(collision.gameObject);
     }
     if (collision.gameObject.tag == "Boss")
     {
         Destroy(this.gameObject);
         HealthBarBoss.SetHealthBarValue(HealthBarBoss.GetHealthBarValue() - 0.03f);
     }
 }