예제 #1
0
    void Update()
    {
        if (playerCoreScript.CanMove())
        {
            float inputH = Input.GetAxisRaw("Horizontal");
            float inputV = Input.GetAxisRaw("Vertical");

            float deltaH = inputH * walkSpeed;
            float deltaV = inputV * walkSpeed;

            Vector2 vel = new Vector2(deltaH, deltaV);
            rigidBody.velocity = vel;

            //Move this to the animation script
            if (inputH != 0 || inputV != 0)
            {
                aniscr.Walk(inputH);
            }
            else
            {
                aniscr.Iddle();
            }
        }
    }