コード例 #1
0
    void Update()
    {
        // Check left hand input
        if (OVRInput.GetDown(OVRInput.Button.PrimaryHandTrigger))
        {
            if (!leftHandGrapple.RopeLoaded())
            {
                leftHandGrapple.LaunchHook(leftHandGrapple.transform);
            }
        }

        if (OVRInput.GetUp(OVRInput.Button.PrimaryHandTrigger))
        {
            if (leftHandGrapple.RopeLoaded())
            {
                leftHandGrapple.DetachHook();
            }
        }

        Vector2 leftAxis = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
        float   leftPush = leftAxis.y;

        if (leftHandGrapple.RopeLoaded())
        {
            leftHandGrapple.ChangeLength(leftPush);
        }

        // Check right hand input
        if (OVRInput.GetDown(OVRInput.Button.SecondaryHandTrigger))
        {
            if (!rightHandGrapple.RopeLoaded())
            {
                rightHandGrapple.LaunchHook(rightHandGrapple.transform);
            }
        }

        if (OVRInput.GetUp(OVRInput.Button.SecondaryHandTrigger))
        {
            if (rightHandGrapple.RopeLoaded())
            {
                rightHandGrapple.DetachHook();
            }
        }

        if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger))
        {
            rightHandWeapon.Shoot();
        }

        Vector2 rightAxis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
        float   rightPush = rightAxis.y;

        if (rightHandGrapple.RopeLoaded())
        {
            rightHandGrapple.ChangeLength(rightPush);
        }

        // Debug Lines
        DrawLine(lhLineRenderer, leftHandGrapple.transform);
        DrawLine(rhLineRenderer, rightHandGrapple.transform);
    }