English 中文(简体)
在一个时间(团结)超过360度、90度的时间里将参与者排在一边?
原标题:Rotating the player beyond 360 degrees, 90 degrees at a time (Unity)?

因此,我是新东西方的编码(去年颁布),因此,我可能会遭受一些错误或混淆,我先发表示歉意。

我试图以同样的方式轮换我的演员,即“Etrian Odyssey”游戏系列,慢慢地把它轮到所期望的核心方向。 我现在大多数工作,参与者轮流离开或按期望享有权利,然而,只要看着“南方”,它只能轮到从哪里轮换(如果参与者从左边轮换,则只有在至少回到一时才能轮换)。

下面是所有与角色轮换有关的法典(不包括卡内方向检查,因为卡内方向检查是我不认为像现在一样的简单强迫和列举)

该守则处理轮调发生时间和我想要达到的轮换。

 else if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                desiredRot = transform.rotation * Quaternion.Euler(0,-90,0);
                StartCoroutine("RotateLeft");
            }
            else if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                desiredRot = transform.rotation * Quaternion.Euler(0, 90, 0);
                StartCoroutine("RotateRight");
            }

该法典处理实际轮换问题,指出这一转变。 期望轮流担任,因为参与者实际上正在研究,但并非当务之急,而是我的工作,而不是眼光。

case Direction.left:
                transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);
                break;
            case Direction.right:
                transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);
                break;

该守则在轮任停止时,以及在选择投入后参与者能够流动时处理。

IEnumerator RotateLeft()
    {
        isMoving = true;
        currentDirection = Direction.left;
        while (transform.rotation.y >= desiredRot.y)
        {
            yield return null;
        }
        currentDirection = Direction.stationary;
        isMoving = false;
    }

   IEnumerator RotateRight()
    {
        isMoving = true;
        currentDirection = Direction.right;
        while (transform.rotation.y <= desiredRot.y)
        {
            yield return null;
        }
        currentDirection = Direction.stationary;
        isMoving = false;
    }

另一个问题是,无论我所尝试过什么,所期望的轮换都是完美无缺的,正如我一样,它从来就没有完美的90度角度来看待这一运动,但坦率地说,我会担心,因为运动是我的优先事项,但认为在问题开始的时候,值得一提。

我不特别记得我自此以来至少一周以来所尝试过什么,而坦率地说,我此时刚刚非常疲 the,我过去的社会焦虑只是问这个问题。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签