예제 #1
0
 void RecordFrames()
 {
     // For each object being recorded, save current position and rotation in list
     for (int i = 0; i < objectToRecord.Length; i++)
     {
         transformsList[i].positionsList.Add(objectToRecord[i].transform.position);
         transformsList[i].rotationsList.Add(objectToRecord[i].transform.rotation);
     }
     // For each key being recorded, save current key and bool in list
     for (int j = 0; j < keysToRecord.Length; j++)
     {
         keyInputList[j].isDownList.Add(IM.GetKey(keysToRecord[j]));
     }
 }
예제 #2
0
    void UpdateMovement_Position()
    {
        // Horizontal
        if (IM.GetKey(KeyCode.D) || IM.GetKey(KeyCode.RightArrow)) // Right Input
        {
            rb.position = new Vector3(rb.position.x + positionSpeed, rb.position.y, rb.position.z);
        }
        else if (IM.GetKey(KeyCode.A) || IM.GetKey(KeyCode.LeftArrow)) // Left Input
        {
            rb.position = new Vector3(rb.position.x - positionSpeed, rb.position.y, rb.position.z);
        }

        // Vertical
        if (IM.GetKey(KeyCode.W) || IM.GetKey(KeyCode.UpArrow)) // Forward Input
        {
            rb.position = new Vector3(rb.position.x, rb.position.y, rb.position.z + positionSpeed);
        }
        else if (IM.GetKey(KeyCode.S) || IM.GetKey(KeyCode.DownArrow)) // Back Input
        {
            rb.position = new Vector3(rb.position.x, rb.position.y, rb.position.z - positionSpeed);
        }
    }