Пример #1
0
    public void Move(Vector3 dir, int a, int d) //인자 값은 Vector3방향, 움직이는 축의 방향
    {
        axis    = (Axis)a;
        dirType = (DirType)d;

        if (axis == Axis.X)
        {
            if (blockManager.BlockIsExist(location[0], (int)blockType, d)) //움직일수있는 위치인지 검사함
            {
                return;
            }

            direction = dir;
            //direction = dir.normalized;

            //if (!BeBlockedByWall())
            //    return;

            destination = transform.position + (direction * 1.3f);

            if (d == 0)                                             //왼쪽으로 이동
            {
                if (location[0] == 12 && blockType == BlockType.Me) //도착지점!!
                {
                    destination = transform.position + (direction * 2.6f);
                    speed       = 15f;

                    //destination += (direction * 1.3f);
                    mouseController.GameClear = true;
                }
            }

            Set_location();

            isMoving = true;
            SoundManger.instance.PlaySound(moveSound);
        }
        else //(axis == Axis.Y)
        {
            if (blockManager.BlockIsExist(location[0], (int)blockType, d))
            {
                return;
            }

            direction = dir;

            destination = transform.position + (direction * 1.3f);

            Set_location();

            isMoving = true;
            SoundManger.instance.PlaySound(moveSound);
        }
    }