protected override bool SetMovementState(CMovState value) { var oldValue = this._currentMovState; if (!base.SetMovementState(value)) { return(false); } // sliding if (value == CMovState.Sliding) { // is sliding now this._slideBeginTime = Time.time; } else if (oldValue == CMovState.Sliding) { // was sliding if (Time.time >= this._slideBeginTime + this._slideTimeToStumble) { if (this._animator) { this._animator.SetTrigger(this.ANIM_CHAR_STUMBLE); } } } return(true); }
/// <summary> /// Set Movement State Enum. /// </summary> /// <returns>Returns if the movement enum was set.</returns> protected virtual bool SetMovementState(CMovState value) { if (this._currentMovState == value) { return(false); } this._currentMovState = value; // set animators if (this._animator) { this._animator.CSetBoolSafe(this.ANIM_CHAR_IS_WALKING, value == CMovState.Walking); this._animator.CSetBoolSafe(this.ANIM_CHAR_IS_RUNNING, value == CMovState.Running); this._animator.CSetBoolSafe(this.ANIM_CHAR_IS_SPRINTING, value == CMovState.Sprint); this._animator.CSetBoolSafe(this.ANIM_CHAR_IS_SLIDING, value == CMovState.Sliding); } return(true); }
public static bool IsMoving(this CMovState movState) { return(movState > CMovState.Idle); }
public static bool IsMovingFast(this CMovState movState) { return(movState > CMovState.Walking); }