public void UpdateAnim(STATE_PLAYER state)
    {
        if (!isFirstFrame)
        {
            nextPos = obj.transform.position;
            lookDir = (nextPos - currentPos);
            lookDir.Normalize();
            currentPos = obj.transform.position;
        }
        else
        {
            isFirstFrame = false;
            currentPos = obj.transform.position;
        }

        changeState(state);
        changeAnim();
    }
    void changeState(STATE_PLAYER state)
    {
        switch (state)
            {
                case STATE_PLAYER.IDLE:
                 {
                    if (news == NEWS.N)
                        finalSt = STATE.B_IDLE;
                    if (news == NEWS.E)
                        finalSt = STATE.R_IDLE;
                    if (news == NEWS.W)
                        finalSt = STATE.L_IDLE;
                    if (news == NEWS.S)
                        finalSt = STATE.F_IDLE;
                   break;
                 }

                case STATE_PLAYER.RUN:
                    {
                        float x = lookDir.x;
                        float z = lookDir.z;
                             float abx=0;
                            float abz=0;
                    if (x < 0)
                        abx = -x;
                    else
                        abx = x;
                    if (z < 0)
                        abz = -z;
                    else
                        abz = z;
                        if (x >0 &&abx-0.01  > abz )
                        {

                        changeDir = true;
                        news = NEWS.E;
                            finalSt = STATE.R_RUN;
                        }
                        else if (z > 0 &&abz-0.01 > abx)
                    {
                        changeDir = true;
                        news = NEWS.N;
                            finalSt = STATE.B_RUN;
                        }
                        else if (x < 0 && abx-0.01> abz)
                    {
                        changeDir = true;
                        news = NEWS.W;
                            finalSt = STATE.L_RUN;
                        }
                        else if (z < 0 && abz-0.01 > abx )
                    {
                        changeDir = true;
                        news = NEWS.S;
                            finalSt = STATE.F_RUN;
                        }

                         break;
                 }
                }
    }