private void UpdateAccordingToState(PlayerAnimationStateEventArgs stateEventArgs) { this.FlipPlayer = stateEventArgs.LastInputAxisHorizontal < 0.0f; if (stateEventArgs.CurrentInputHorizontalAxis.Magnitude() > 0.01f) { this.walkAnimatorController.Resume(); } else { this.walkAnimatorController.Pause(); } }
private void Move() { this.target.AddForce(this.gravityVelocity, ForceMode2D.Force); Vector2 velocity = this.target.velocity; velocity.x = this._velocity.x; this.target.velocity = velocity; PlayerAnimationStateEventArgs stateEventArgs = new PlayerAnimationStateEventArgs(this._lastHorizontalAxis, this.inputSO.HorizontalAxis); this.movementSO.OnMovementStateUpdated(stateEventArgs); if (this.inputSO.HorizontalAxis.Magnitude() > 0.01f) { this._lastHorizontalAxis = this.inputSO.HorizontalAxis; } }
public void OnMovementStateUpdated(PlayerAnimationStateEventArgs e) { this.MovementStateUpdated?.Invoke(this, e); }
private void MovementStateUpdatedEventHandler(object sender, PlayerAnimationStateEventArgs e) { this.UpdateAccordingToState(e); }