Exemplo n.º 1
0
        public void StartTrackingHardwarePlayer(Hardware.HardwarePlayer hardwarePlayer)
        {
            if (!photonView.isMine)
            {
                Debug.Log("Attempting to locally track player that isn't owned by this client. Bailing. This is a bug.");
                return;
            }
            if (_hardwarePlayer != null)
            {
                Debug.Log("StartTrackingHardwarePlayer called on player that is already tracking locally. Bailing. This is a bug.");
                return;
            }

            _hardwarePlayer = hardwarePlayer;

            _hardwarePlayer.transformUpdated              += new Hardware.TransformUpdatedDelegate(SpaceTransformUpdated);
            _hardwarePlayer.headset.activeUpdated         += new Hardware.ActiveUpdatedDelegate(HeadsetActiveUpdated);
            _hardwarePlayer.leftController.activeUpdated  += new Hardware.ActiveUpdatedDelegate(LeftControllerActiveUpdated);
            _hardwarePlayer.rightController.activeUpdated += new Hardware.ActiveUpdatedDelegate(RightControllerActiveUpdated);
            SyncInitialActiveState();

            head.StartTrackingHardwarePlayer(_hardwarePlayer.headset);
            leftHand.StartTrackingHardwarePlayer(_hardwarePlayer.leftController);
            rightHand.StartTrackingHardwarePlayer(_hardwarePlayer.rightController);
        }
Exemplo n.º 2
0
        public void StopTrackingHardwarePlayer()
        {
            if (_hardwarePlayer == null)
            {
                return;
            }

            _hardwarePlayer.transformUpdated              -= new Hardware.TransformUpdatedDelegate(SpaceTransformUpdated);
            _hardwarePlayer.headset.activeUpdated         -= new Hardware.ActiveUpdatedDelegate(HeadsetActiveUpdated);
            _hardwarePlayer.leftController.activeUpdated  -= new Hardware.ActiveUpdatedDelegate(LeftControllerActiveUpdated);
            _hardwarePlayer.rightController.activeUpdated -= new Hardware.ActiveUpdatedDelegate(RightControllerActiveUpdated);
            _hardwarePlayer = null;
        }