예제 #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);
        }
    }
    protected override void UpdateAction()
    {
        //一定時間経過でIdleに遷移
        if (m_elapsedTime > m_playerStatus.MaxRushAttackTime)
        {
            m_stateMachine.ChangeState(EPlayerActionState.Idle);
        }
        //壁に当たると張り付き
        if (m_collisionDetector.IsHitWall())
        {
            m_stateMachine.ChangeState(EPlayerActionState.WallStay);
        }

        m_elapsedTime += Time.deltaTime;
    }
예제 #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;
    }