private void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Charger") { if (energySystem.state == EnergyState.Dashing || energySystem.state == EnergyState.ChargingDashing) { energySystem.SetState(EnergyState.ChargingDashing); } else { energySystem.SetState(EnergyState.Charging); } } }
private void DoADash() { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { if (energySystem.currentEnergy > 0) { dashDelay -= Time.deltaTime; if (dashDelay <= 0) { if (energySystem.state == EnergyState.Charging || energySystem.state == EnergyState.ChargingDashing) { energySystem.SetState(EnergyState.ChargingDashing); } else { energySystem.SetState(EnergyState.Dashing); } StartCoroutine(Dash()); } else { animator.SetBool("Dash", true); } } else { if (energySystem.state == EnergyState.ChargingDashing) { energySystem.SetState(EnergyState.Charging); } else { energySystem.SetState(EnergyState.Consuming); } animator.SetBool("Dash", false); dashDelay = dashtimeDelay; } } if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift)) { if (energySystem.state == EnergyState.ChargingDashing) { energySystem.SetState(EnergyState.Charging); } else { energySystem.SetState(EnergyState.Consuming); } animator.SetBool("Dash", false); dashDelay = dashtimeDelay; } }