コード例 #1
0
        void CheckTriggerStatus()
        {
            /*** Define trigger key to fire events for different platforms ***/
#if UIKIT_OCULUS
            activeController = OVRInput.GetActiveController();
            // Check if Oculus Rift is being used, then we need to check if button is pressed on target pointer.
            if (activeController == OVRInput.Controller.Touch ||
                activeController == OVRInput.Controller.LTouch || activeController == OVRInput.Controller.RTouch)
            {
                if (pointer == Pointer.LeftHand)
                {
                    triggerPressed = OVRInput.Get(trigger, OVRInput.Controller.LTouch);
                }
                else if (pointer == Pointer.RightHand)
                {
                    triggerPressed = OVRInput.Get(trigger, OVRInput.Controller.RTouch);
                }
            }
            else
            {
                triggerPressed = OVRInput.Get(trigger);
            }
#elif UIKIT_VIVE_STEAM_2
            // Using the action system
            if (pointer == Pointer.LeftHand)
            {
                triggerPressed = triggerAction.GetState(SteamVR_Input_Sources.LeftHand);
            }
            else if (pointer == Pointer.RightHand)
            {
                triggerPressed = triggerAction.GetState(SteamVR_Input_Sources.RightHand);
            }
#elif UIKIT_VIVE
            if (pointer == Pointer.LeftHand)
            {
                if (null == ControllerLeft)
                {
                    return;
                }
                triggerPressed = ControllerLeft.GetPress(trigger);
            }
            else if (pointer == Pointer.RightHand)
            {
                if (null == ControllerRight)
                {
                    return;
                }
                triggerPressed = ControllerRight.GetPress(trigger);
            }
#else
            triggerPressed = Input.GetKey("space");
#endif
        }
コード例 #2
0
ファイル: ServerWorld.cs プロジェクト: slango0513/Papagei
        /// <summary>
        /// Wraps an incoming connection in a peer and stores it.
        /// </summary>
        public void RemovePeer(IConnection peer)
        {
            if (clients.ContainsKey(peer))
            {
                var client = clients[peer];
                clients.Remove(peer);

                ControllerLeft.Invoke(client);

                // Revoke control of all the entities controlled by that controller
                {
                    // ServerConnection.Shutdown
                    foreach (var entity in client.ControlledEntities)
                    {
                        entity.Controller = null;
                        entity.IncomingCommands.Clear();
                        entity.DeferNotifyControllerChanged = true;
                    }
                    client.ControlledEntities.Clear();
                }
            }
        }