private void UpdateDashTimer() { if (dashTimerIsActive) { dashTimerCur += Time.deltaTime; if (dashTimerCur > dashTimerMax) { dashTimerIsActive = false; dashingDirection = InputManager.Direction.None; StopDash(); } } }
// Update is called once per frame void Update() { UpdateDashTimer(); if (!dashTimerIsActive && inputMngr.DoubleTapDirection != InputManager.Direction.None && !wildCat.isOverHeat) { StartDashTimer(); StartDash(inputMngr.DoubleTapVector); dashingDirection = inputMngr.DoubleTapDirection; } if (dashTimerIsActive && dashingDirection == InputManager.Direction.Right) RightShieldObject.SetActive(true); else if (!dashTimerIsActive && rightCurrentFadeTime >= fadeDuration) RightShieldObject.SetActive(false); if (dashTimerIsActive && dashingDirection == InputManager.Direction.Left) LeftShieldObject.SetActive(true); else if (!dashTimerIsActive && leftCurrentFadeTime >= fadeDuration) LeftShieldObject.SetActive(false); //FadeOut the Shield if not active if (!dashTimerIsActive && rightCurrentFadeTime < fadeDuration) { RightShieldObject.renderer.material.color = Color.Lerp (colorStart, colorEnd, rightCurrentFadeTime/fadeDuration); rightCurrentFadeTime += Time.deltaTime; } if (!dashTimerIsActive && leftCurrentFadeTime < fadeDuration) { LeftShieldObject.renderer.material.color = Color.Lerp (colorStart, colorEnd, leftCurrentFadeTime/fadeDuration); leftCurrentFadeTime += Time.deltaTime; } }