void Update() { if (HealthBarBoss.GetHealthBarValue() <= 0) { youWin.enabled = true; Destroy(gameObject); SceneManager.LoadScene("Scene1"); } }
// 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"); }
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); } }