public virtual void AttemptAttack() { if (cooldown_remaining <= 0f) { if (energy.Drain_ES(true, energyCost)) { if (FaceCursor) { playerMovement.SetFollowCursor(STARTUP_DECLARATIONS.AbilityAnimationCastTime[(int)abilityAnimation]); } cooldown_remaining = cooldown; if (CustomBreakFunc()) { return; } Cast_at_this_time = cooldown - STARTUP_DECLARATIONS.AbilityAnimationCastTime[(int)abilityAnimation]; AbilityAttackAnimation(); abilitiesController.SetCurrentAbility(this); abilitiesController.abilityUsed(true); } } }
public void UpdatePlayerState() { if (GetMoveState() == MoveState.ForceBased) { return; } else if (GetMoveState() == MoveState.Rolling) { RollTimer -= Time.deltaTime; if (RollTimer > 0) { return; } } if (Input.GetKeyDown(KeyCode.Space)) //Can cancel Ranged animation { if (energy.Drain_ES(false, rollEnergyCost)) { Roll(); return; } } else if (moveState == MoveState.FollowCursor && (FollowCursorTimer > 0 || HoldCursorFollow)) { return; } // TODO: Handle for controllers float controlThrowX = Mathf.Abs(Input.GetAxis("Horizontal")); float controlThrowY = Mathf.Abs(Input.GetAxis("Vertical")); if (controlThrowX > 0 || controlThrowY > 0) { if (Input.GetKey(KeyCode.LeftShift) && energy.Drain_ES_Greater(false, sprintEnergyCost, (moveState != MoveState.Running), MinSprintCost)) { moveState = MoveState.Running; } else { moveState = MoveState.Walking; } } else { moveState = MoveState.Idle; } }