Ejemplo n.º 1
0
    protected override void UpdateAction()
    {
        //Jumpに遷移
        if (KeyboardInputProvider.Instance.IsJump)
        {
            if (m_collisionDetector.IsHitWall())
            {
                m_stateMachine.ChangeState(EPlayerActionState.WallJump);
            }
            else if (m_collisionDetector.IsHitGround())
            {
                m_stateMachine.ChangeState(EPlayerActionState.Jump);
            }
        }

        //Runに遷移
        var horizontalInput = KeyboardInputProvider.Instance.HorizontalInput;

        if (Mathf.Abs(horizontalInput) > 0.0f)
        {
            m_stateMachine.ChangeState(EPlayerActionState.Run);
        }

        //RushAttackに遷移
        if (KeyboardInputProvider.Instance.IsRushAttack)
        {
            m_stateMachine.ChangeState(EPlayerActionState.RushAttack);
        }
    }
Ejemplo n.º 2
0
    protected override void UpdateAction()
    {
        var horizontalInput = KeyboardInputProvider.Instance.HorizontalInput;

        //移動処理
        var velocity = m_rb.velocity;

        velocity.x    = horizontalInput * m_playerStatus.MoveSpeed;
        m_rb.velocity = velocity;

        //Idleに遷移
        if (Mathf.Abs(horizontalInput) < 0.01f)
        {
            m_stateMachine.ChangeState(EPlayerActionState.Idle);
        }

        //Jumpに遷移
        if (KeyboardInputProvider.Instance.IsJump && m_collisionDetector.IsHitGround())
        {
            m_stateMachine.ChangeState(EPlayerActionState.Jump);
        }

        if (KeyboardInputProvider.Instance.IsRushAttack)
        {
            m_stateMachine.ChangeState(EPlayerActionState.RushAttack);
        }
    }
Ejemplo n.º 3
0
    protected override void UpdateAction()
    {
        var horizontalInput = KeyboardInputProvider.Instance.HorizontalInput;

        //空中移動
        if (Mathf.Abs(horizontalInput) > 0.0f)
        {
            var velocity = m_rb.velocity;
            velocity.x    = horizontalInput * m_playerStatus.MoveSpeed * m_playerStatus.AirResistanceScale;
            m_rb.velocity = velocity;
        }

        //長押しでジャンプ力変更
        if (m_elapsedTime < m_playerStatus.MaxJumpTime && KeyboardInputProvider.Instance.IsJumpHolding)
        {
            var velocity = m_rb.velocity;
            velocity.y    = m_playerStatus.JumpSpeed;
            m_rb.velocity = velocity;
        }

        if (m_collisionDetector.IsHitWall())
        {
            m_stateMachine.ChangeState(EPlayerActionState.WallStay);
        }

        //接地判定
        if (m_collisionDetector.IsHitGround())
        {
            if (m_rb.velocity.y < 0.0f)
            {
                m_stateMachine.ChangeState(EPlayerActionState.Idle);
            }
        }

        if (KeyboardInputProvider.Instance.IsRushAttack)
        {
            m_stateMachine.ChangeState(EPlayerActionState.RushAttack);
        }

        m_elapsedTime += Time.deltaTime;
    }