// Update is called once per frame void Update() { if (On == true) { Charge -= Time.deltaTime * drainRate; if (Charge <= 0) { Charge = 0; On = false; var tempmaterialarray = rend.materials; tempmaterialarray[0] = wing_N; tempmaterialarray[3] = engine_N; rend.materials = tempmaterialarray; E.SetActive(true); EP.SetActive(false); ready = false; /* rend.materials[0] = wing_N; * rend.materials[3] = engine_N; */ powerUpDepletedSFX.Play(); } statusBars.SetFill(Charge); } //if (On == false && Input.GetButtonDown("Fire2") && Charge >= 50) //{ // On = true; // var tempmaterialarray = rend.materials; // tempmaterialarray[0] = wing_P; // tempmaterialarray[3] = engine_P; // rend.materials = tempmaterialarray; // /* rend.materials[0] = wing_P; // rend.materials[3] = engine_P; */ //} }
void TakeDamage(int dam) { Health -= dam; HP.SetFill(Health); }