コード例 #1
0
    private void Update()
    {
        //Update My Avatar
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (isOwnedLocally)
            {
                _RealtimeView.RequestOwnership();
            }
            else
            {
                return;
            }

            if (!_RealtimeView.isOwnedLocally)
            {
                return;
            }

            _Index = getNewIndex();

            foreach (GameObject _Player in GameObject.FindGameObjectsWithTag("Player"))
            {
                IntegerSyncScript tmpIntSyncScript = _Player.GetComponent <IntegerSyncScript>();

                if (tmpIntSyncScript != this)
                {
                    if (_Index == tmpIntSyncScript._Index)
                    {
                        _Index = getNewIndex();
                    }
                }
            }

            _integerSync.SetAvatarIndex(_Index);
        }

        //Sync All Avatars
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (!isOwnedLocally)
            {
                return;
            }

            int syncedIndex = getNewIndex();

            foreach (GameObject _Player in GameObject.FindGameObjectsWithTag("Player"))
            {
                IntegerSyncScript tmpIntSyncScript = _Player.GetComponent <IntegerSyncScript>();

                _Player.GetComponent <RealtimeView>().RequestOwnership();

                tmpIntSyncScript._integerSync.SetAvatarIndex(syncedIndex);
            }
        }
    }
コード例 #2
0
 void Update()
 {
     // If the _float has changed (via the inspector), call SetFloat on the slider sync component.
     if (_value != _previousValue)
     {
         _realtimeView.RequestOwnership();
         _sliderSync.SetSliderValue(_value);
         _previousValue = _value;
         text.text      = _value.ToString();
     }
 }
コード例 #3
0
 public virtual void _OnGrab()
 {
     tmpKinematic = insideRigidbody.isKinematic;
     insideRigidbody.isKinematic = makeKinematic;
     insideRealtime.RequestOwnership();
     insideView.RequestOwnership();
     grabbing = true;
     if (grabbedGrabbable == null)
     {
         Debug.Log("You have a grab triggered with no grab");
     }
     else
     {
         grabbedGrabbable.GrabObject(view.ownerID, right);
     }
     OnGrab();
 }
コード例 #4
0
    void OnCollisionEnter(Collision c)
    {
        RealtimeView rtv = c.collider.gameObject.GetComponent <RealtimeView>();

        if (rtv != null)
        {
            if (rtv.isOwnedLocally == true)
            {
                rtTransform.RequestOwnership();
                rtView.RequestOwnership();
                transform.position = Random.insideUnitSphere + new Vector3(0, 1, 0);
                scorer.NewScore();
            }
            else
            {
                print("NOT OWNED LOCALLY");
            }
        }
    }
コード例 #5
0
ファイル: GrabRequest.cs プロジェクト: IRezzet/escape-room
    private void Update()
    {
        if (OVRInput.Get(OVRInput.Button.PrimaryHandTrigger) || OVRInput.Get(OVRInput.Button.SecondaryHandTrigger))
        {
            _realtimeTransform.RequestOwnership();
            _realtimeView.RequestOwnership();
        }

        //while(!(OVRInput.Get(OVRInput.Button.PrimaryHandTrigger) || OVRInput.Get(OVRInput.Button.SecondaryHandTrigger)))
        //{
        //    if (OVRInput.Get(OVRInput.Button.PrimaryHandTrigger) || OVRInput.Get(OVRInput.Button.SecondaryHandTrigger))
        //     {
        //         _realtimeTransform.ClearOwnership();
        //        _realtimeView.ClearOwnership();
        //     }
        //}

        if (OVRInput.Get(OVRInput.Button.One))
        {
            _realtimeTransform.ClearOwnership();
            _realtimeView.ClearOwnership();
        }
    }
コード例 #6
0
ファイル: RealtimeThrowable.cs プロジェクト: blujay/throwme
 public void Grabbed()
 {
     bob.RequestOwnership();
     bill.RequestOwnership();
 }
コード例 #7
0
 // Update is called once per frame
 public void Grabbed()
 {
     rtTransform.RequestOwnership();
     rtView.RequestOwnership();
     ownership = rtTransform.ownerID;
 }