void ShieldControl() { if ((CrossPlatformInputManager.GetAxis(triggersButton) > 0) && m_canShield) { if (!m_isDodging) { m_Character.HalfGravityScale(); m_Character.StopMovementHorizontal(); } if (!m_isShielding) { m_isAxisInUse = true; m_Character.StopMovement(); } m_isShielding = true; shieldSprite.SetActive(true); } else if (m_isShielding) { StopShielding(); } if (!m_canShield) { m_betweenShieldTimer += Time.deltaTime; if (m_betweenShieldTimer > m_timeBetweenShield) { m_canShield = true; m_betweenShieldTimer = 0.0f; } } if (m_isShielding) { m_shieldChargeCurrent -= (m_shieldDrainRate * Time.deltaTime); if (m_shieldChargeCurrent < 0) { StopShielding(); m_shieldChargeCurrent = 0; } } else if (!m_isShielding && (m_shieldChargeCurrent < m_shieldChargeMax)) { m_shieldChargeCurrent += (m_shieldRechargeRate * Time.deltaTime); if (m_shieldChargeCurrent > m_shieldChargeMax) { m_shieldChargeCurrent = m_shieldChargeMax; } } if (m_isShielding && m_canDodge) { if (CrossPlatformInputManager.GetAxisRaw(horizontalAxisButton) != 0) { if (!m_isAxisInUse) { if (CrossPlatformInputManager.GetAxisRaw(horizontalAxisButton) < 0) { m_Character.DodgeLeft(); } else { m_Character.DodgeRight(); } m_isDodging = true; m_isAxisInUse = true; } } if (CrossPlatformInputManager.GetAxisRaw(horizontalAxisButton) == 0) { m_isAxisInUse = false; } } }