コード例 #1
0
        private void UpdateAccordingToState(PlayerAnimationStateEventArgs stateEventArgs)
        {
            this.FlipPlayer = stateEventArgs.LastInputAxisHorizontal < 0.0f;

            if (stateEventArgs.CurrentInputHorizontalAxis.Magnitude() > 0.01f)
            {
                this.walkAnimatorController.Resume();
            }
            else
            {
                this.walkAnimatorController.Pause();
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 public void OnMovementStateUpdated(PlayerAnimationStateEventArgs e)
 {
     this.MovementStateUpdated?.Invoke(this, e);
 }
コード例 #4
0
 private void MovementStateUpdatedEventHandler(object sender, PlayerAnimationStateEventArgs e)
 {
     this.UpdateAccordingToState(e);
 }