void Update() { if (this.transform.position.y > finalPos.y) { this.transform.Translate(0, (-moveSpeed * Time.deltaTime), 0); } Mathf.Clamp(this.transform.position.y, 1, 8); float hpBar = hp / maxhp; hpGO.rectTransform.localScale = new Vector3(hpBar, 1, 1); if (hp <= 0) { shake.CamShake(); mainController.bossKill = true; Destroy(this.gameObject); } Shooting(); }
void Update() { wait += Time.deltaTime; float hpBar = hp / maxhp; healthBar.rectTransform.localScale = new Vector3(hpBar, 1, 1); if (hp <= 0) { GameObject explosion = Instantiate(killParticleSystem, this.transform.position, this.transform.rotation); explosion.transform.parent = null; shake.CamShake(); mainController.score += 10f; Destroy(this.gameObject); } if (wait > maxWait) { if (mainController.best1 == this.gameObject) { Shooting(); } else if (mainController.best2 == this.gameObject) { Shooting(); } else if (mainController.best3 == this.gameObject) { Shooting(); } else if (mainController.best4 == this.gameObject) { Shooting(); } wait = 0f; maxWait = Random.Range(1, 5); } }