// Update is called once per frame void Update() { transform.Translate(0, Speed * Time.deltaTime, 0);//Local if (OutScreen()) { Destroy(this.gameObject); } if (Curr_Health <= 0) { PlayingController_Script.AddScore(score);// Add Score if (Random.value < itemRate) { Instantiate(ShieldIcon, this.transform.position, Quaternion.Euler(0, 0, 0)); } Destroy(this.gameObject); } if (shootType == 0) { normalFire(ref lastShootTime); } else { taggetFire(ref lastShootTime); } healthBar.transform.GetChild(0).transform.localScale = new Vector3(Curr_Health / Max_Health, healthBar.transform.GetChild(0).transform.localScale.y, healthBar.transform.GetChild(0).transform.localScale.z); //Debug.Log(); }
void OnTriggerEnter2D(Collider2D coll) { if (coll.tag == "Player") { coll.GetComponent <Player_Ship>().activeShield(); PlayingController_Script.AddScore(100); Destroy(this.gameObject); } }
// Update is called once per frame void Update() { Move(ref direction); Fire(); healthBar.transform.GetChild(0).transform.localScale = new Vector3(Curr_Health / Max_Health, healthBar.transform.GetChild(0).transform.localScale.y, healthBar.transform.GetChild(0).transform.localScale.z); if (Curr_Health <= 0) { PlayingController_Script.AddScore(score);// Add Score if (Random.value < itemRate) { Instantiate(ShieldIcon, this.transform.position, Quaternion.Euler(0, 0, 0)); } Destroy(this.gameObject); } }