Beispiel #1
0
    public override void Update()
    {
        base.Update();

        m_Character.GetComponent <Animator>().SetFloat("VelocityX", Math.Abs(m_Character.m_TotalForce.x));


        if (Math.Sign(m_HorizontalAxis) == 1)
        {
            m_Character.m_FacingRight = true;
        }

        if (Math.Sign(m_HorizontalAxis) == -1)
        {
            m_Character.m_FacingRight = false;
        }

        m_Character.m_TotalForce = new Vector3(m_Velocity, 0.0f, 0.0f);
        if (m_PlaneShiftButton > 0.0f)
        {
            m_NextState = new MovementPlaneShift(m_Character);
        }
        else
        {
            if (Math.Abs(m_Velocity) == 0.0f && m_HorizontalAxis == 0.0f)
            {
                m_NextState = new MovementIdle(m_Character);
            }
            if (m_JumpButton == true)
            {
                m_NextState = new MovementJump(m_Character);
            }
            if (m_Character.m_Opponent != null)
            {
                m_NextState = new BattleWalk(m_Character);
            }

            if (m_LightAttackButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_NextState = new MovementLightAttackDown(m_Character);
                }
                else
                {
                    m_NextState = new MovementLightAttackUp(m_Character);
                }
            }

            if (m_HeavyAttackButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_NextState = new MovementHeavyAttackDown(m_Character);
                }
                else
                {
                    m_NextState = new MovementHeavyAttackUp(m_Character);
                }
            }

            if (m_BlockButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_Character.GetComponent <Animator>().SetBool("BlockDown", true);
                    m_NextState = new MovementBlockDown(m_Character);
                }

                else
                {
                    m_Character.GetComponent <Animator>().SetBool("BlockUp", true);
                    m_NextState = new MovementBlockUp(m_Character);
                }
            }
        }
    }
Beispiel #2
0
    public override void Update()
    {
        base.Update();


        if (m_PlaneShiftButton > 0.0f)
        {
            m_NextState = new MovementPlaneShift(m_Character);
        }
        else
        {
            if (Math.Abs(m_HorizontalAxis) >= 0.1f)
            {
                m_NextState = new MovementWalk(m_Character);
            }
            if (m_JumpButton == true)
            {
                m_NextState = new MovementJump(m_Character);
            }
            if (m_CrouchButton == true)
            {
                m_NextState = new MovementCrouch(m_Character);
            }
            if (m_Character.m_Opponent != null)
            {
                m_NextState = new BattleIdle(m_Character);
            }

            if (m_LightAttackButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_NextState = new MovementLightAttackDown(m_Character);
                }
                else
                {
                    m_NextState = new MovementLightAttackUp(m_Character);
                }
            }

            if (m_HeavyAttackButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_NextState = new MovementHeavyAttackDown(m_Character);
                }
                else
                {
                    m_NextState = new MovementHeavyAttackUp(m_Character);
                }
            }

            if (m_BlockButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_Character.GetComponent <Animator>().SetBool("BlockDown", true);
                    m_NextState = new MovementBlockDown(m_Character);
                }

                else
                {
                    m_Character.GetComponent <Animator>().SetBool("BlockUp", true);
                    m_NextState = new MovementBlockUp(m_Character);
                }
            }
        }
    }
    public override void Update()
    {
        base.Update();

        m_Character.GetComponent<Animator>().SetFloat("VelocityX", Math.Abs(m_Character.m_TotalForce.x));

        if (Math.Sign(m_HorizontalAxis) == 1)
        {
            m_Character.m_FacingRight = true;
        }

        if (Math.Sign(m_HorizontalAxis) == -1)
        {
            m_Character.m_FacingRight = false;
        }

        m_Character.m_TotalForce = new Vector3(m_Velocity, 0.0f, 0.0f);
        if (m_PlaneShiftButton > 0.0f)
        {
            m_NextState = new MovementPlaneShift(m_Character);
        }
        else
        {
            if (Math.Abs(m_Velocity) == 0.0f && m_HorizontalAxis == 0.0f)
            {
                m_NextState = new MovementIdle(m_Character);
            }
            if (m_JumpButton == true)
            {
                m_NextState = new MovementJump(m_Character);
            }
            if (m_Character.m_Opponent != null)
            {
                m_NextState = new BattleWalk(m_Character);
            }

            if (m_LightAttackButton == true)
            {

                if (m_VerticalAxis < -0.1f)
                    m_NextState = new MovementLightAttackDown(m_Character);
                else
                    m_NextState = new MovementLightAttackUp(m_Character);
            }

            if (m_HeavyAttackButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                    m_NextState = new MovementHeavyAttackDown(m_Character);
                else
                    m_NextState = new MovementHeavyAttackUp(m_Character);
            }

            if (m_BlockButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_Character.GetComponent<Animator>().SetBool("BlockDown", true);
                    m_NextState = new MovementBlockDown(m_Character);
                }

                else
                {
                    m_Character.GetComponent<Animator>().SetBool("BlockUp", true);
                    m_NextState = new MovementBlockUp(m_Character);
                }
            }
        }
    }
    public override void Update()
    {
        base.Update();

        if (m_PlaneShiftButton > 0.0f)
        {
            m_NextState = new MovementPlaneShift(m_Character);
        }
        else
        {

            if (Math.Abs(m_HorizontalAxis) >= 0.1f)
            {
                m_NextState = new MovementWalk(m_Character);
            }
            if (m_JumpButton == true)
            {
                m_NextState = new MovementJump(m_Character);
            }
            if (m_CrouchButton == true)
            {
                m_NextState = new MovementCrouch(m_Character);
            }
            if(m_Character.m_Opponent != null)
            {
                m_NextState = new BattleIdle(m_Character);
            }

            if (m_LightAttackButton == true)
            {

                if (m_VerticalAxis < -0.1f)
                    m_NextState = new MovementLightAttackDown(m_Character);
                else
                    m_NextState = new MovementLightAttackUp(m_Character);
            }

            if (m_HeavyAttackButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                    m_NextState = new MovementHeavyAttackDown(m_Character);
                else
                    m_NextState = new MovementHeavyAttackUp(m_Character);
            }

            if (m_BlockButton == true)
            {
                if (m_VerticalAxis < -0.1f)
                {
                    m_Character.GetComponent<Animator>().SetBool("BlockDown", true);
                    m_NextState = new MovementBlockDown(m_Character);
                }

                else
                {
                    m_Character.GetComponent<Animator>().SetBool("BlockUp", true);
                    m_NextState = new MovementBlockUp(m_Character);
                }
            }

        }
    }