Пример #1
0
    //플레이어 캐릭터 이동
    void Move(int KeyCode)
    {
        Vector3 pos;

        if (KeyCode >= 16)
        {
            KeyCode -= 16;
        }
        if (!animAttackLayer.IsName("Empty"))
        {
            return;
        }

        switch ((MOVEARROW)KeyCode)
        {
        case MOVEARROW.MOVE_UP: pos = (Quaternion.AngleAxis(0, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        case MOVEARROW.MOVE_DOWN: pos = (Quaternion.AngleAxis(180, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        case MOVEARROW.MOVE_LEFT: pos = (Quaternion.AngleAxis(-90, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        case MOVEARROW.MOVE_UL: pos = (Quaternion.AngleAxis(-45, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        case MOVEARROW.MOVE_DL: pos = (Quaternion.AngleAxis(-135, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        case MOVEARROW.MOVE_RIGHT: pos = (Quaternion.AngleAxis(90, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        case MOVEARROW.MOVE_UR: pos = (Quaternion.AngleAxis(45, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        case MOVEARROW.MOVE_DR: pos = (Quaternion.AngleAxis(135, Vector3.up) * cameraMove.GetCameraFowardDir()).normalized * moveSpeed * Time.deltaTime; break;

        default: pos = Vector3.zero; break;
        }

        if (KeyCode != 0)
        {
            anim.SetBool("IsMove", true);
        }
        else
        {
            anim.SetBool("IsMove", false);
        }

        player.transform.position += pos;
    }