示例#1
0
    void emitVRActionVector2Change(SteamVR_Action_Vector2 action, Vector2 value)
    {
        if (ClientManager.instance.state != BaseNetworking.componentState.RUNNING || ClientManager.instance.workerClient == null)
        {
            return;
        }
        Debug.Log("sending vector2 of " + action.GetShortName() + "=" + value.x + "-" + value.y);

        VRActionVector2Message message = new VRActionVector2Message();

        message.actionName = action.GetShortName();
        message.value_0    = value.x;
        message.value_1    = value.y;
        ClientManager.instance.workerClient.sendMessage(message);
    }
示例#2
0
    public static object getValueFromVRActionMessage(VRActionMessage message)
    {
        switch (message.syncedValueType)
        {
        case VRActionMessage.syncType.VECTOR1: {
            VRActionVector1Message syncMessageDetailed = (VRActionVector1Message)message;
            return(syncMessageDetailed.value);
        }

        case VRActionMessage.syncType.VECTOR2: {
            VRActionVector2Message syncMessageDetailed = (VRActionVector2Message)message;
            return(new Vector2(syncMessageDetailed.value_0, syncMessageDetailed.value_1));
        }

        case VRActionMessage.syncType.BOOL: {
            VRActionBoolMessage syncMessageDetailed = (VRActionBoolMessage)message;
            return(syncMessageDetailed.value);
        }

        default: {
            return(null);
        }
        }
    }