// Update is called once per frame void Update() { // TODO UpdateDashPanelActive() should probably be called when the dash ability is collected if (GameManager.dashIsCharged()) { dashImg.color = Color.Lerp(dashImg.color, Color.white, colorLerpSpeed * Time.deltaTime); // Executes when the dash has finished charging if (!charged) { if (!GlobalAudio.ClipIsPlaying(AudioLibrary.inst.dashRecharge)) { AudioLibrary.PlayDashRechargeSound(); } charged = true; dashParticlesIn.Play(); } } // If charging else { dashImg.color = Color.Lerp(dashImg.color, chargingSpriteColor, colorLerpSpeed * Time.deltaTime); // TODO set image fill float fillTarget = 1 - GameManager.dashChargePercNormalized(); dashImg.fillAmount = Mathf.Lerp(dashImg.fillAmount, fillTarget, fillLerpSpeed * Time.deltaTime); //dashImg.fillAmount = 1 - GameManager.dashChargePercNormalized(); charged = false; } /* * // Turn off dash image (make transparent) while dashing * if (GameManager.isPlayerDashing()) * { * dashImg.color = Color.Lerp(dashImg.color, Color.clear, 0.2f); * } * // If charged * else if (GameManager.dashIsCharged()) * { * dashImg.color = Color.Lerp(dashImg.color, Color.white, 0.2f); * } * // If charging * else * { * dashImg.color = Color.Lerp(dashImg.color, chargingSpriteColor, 0.2f); * * // TODO set image fill * } */ }