예제 #1
0
    private void Update()
    {
        // Ownerを表示
        // 全員のLocalでOwner名を取得して表示処理をしているため同期する(Ownerは必ず1人)
        ownerText.text = Networking.GetOwner(this.gameObject).displayName;

        // サイコロを持っていない時にOwnerのLocalのみで処理をする
        if (Networking.IsOwner(Networking.LocalPlayer, this.gameObject) && !isPickupping)
        {
            // サイコロが止まったときの処理
            if (rigidbody.velocity == Vector3.zero)
            {
                // チートを使用する状態で, サイコロのz軸が上を向いていなければ
                // Vector3.Dot(this.transform.forward, Vector3.up) == 1.0fなら完全に上を向いている
                // -1.0:逆向き, 1.0:同じ向き 0.0:直交
                if (cheatToggle.isOn && Vector3.Dot(this.transform.forward, Vector3.up) < 0.6f)
                {
                    float x = Random.Range(0f, 1f);
                    float y = Random.Range(0f, 1f);
                    float z = Random.Range(0f, 1f);

                    var forceAndTorque = new Vector3(x, y, z);

                    // 一瞬だけランダムな方向に速度と回転を与える
                    rigidbody.AddForce(forceAndTorque, ForceMode.Impulse);
                    rigidbody.AddTorque(forceAndTorque * Mathf.PI, ForceMode.Impulse);
                }
                else
                {
                    // 上を向いているなら記録を停止
                    recorder.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.Owner, "StopRecordingInOwner");
                }
            }
        }
    }
예제 #2
0
        //end



        public override void Interact()
        {
            if (behaviour != null)
            {
                Debug.Log($"{gameObject.name}: {behaviour.gameObject.name}: {eventName}");

                if (networked)
                {
                    if (networkedAll)
                    {
                        behaviour.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, eventName);
                    }
                    else
                    {
                        behaviour.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.Owner, eventName);
                    }
                }
                else
                {
                    behaviour.SendCustomEvent(eventName);
                }
            }

            if (animator != null)
            {
                if (networked)
                {
                    SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(ActivateAnimation));
                }
                else
                {
                    animator.SetBool(stateName, boolStateValue);
                }
            }

            //akalink added
            if (audioSource != null)
            {
                if (networked)
                {
                    SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(PlayAudio));
                }
                else
                {
                    audioSource.Play();
                }
            }
            //end
        }
 public override void Interact()
 {
     if (operation == Operation_RESET)
     {
         counter.SendCustomNetworkEvent(NetworkEventTarget.All, "Reset");
     }
     else if (operation == Operation_ADD)
     {
         counter.SendCustomNetworkEvent(NetworkEventTarget.All, "Increment");
     }
     else if (operation == Operation_SUBTRACT)
     {
         counter.SendCustomNetworkEvent(NetworkEventTarget.All, "Subtract");
     }
 }
예제 #4
0
 public override void Interact()
 {
     if (udonToToggle != null)
     {
         udonToToggle.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, "Toggle");
     }
 }
예제 #5
0
        public override void Interact()
        {
            if (isMasterOnlyEvent && !Networking.IsMaster)
            {
                return;
            }

            if (isOwnerOnlyEvent && !Networking.IsOwner(gameObject))
            {
                return;
            }

            if (!udonBehaviour)
            {
                return;
            }

            if (!isGlobalEvent)
            {
                udonBehaviour.SendCustomEvent(customEventName);
            }
            else
            {
                udonBehaviour.SendCustomNetworkEvent(NetworkEventTarget.All, customEventName);
            }
        }
예제 #6
0
 public override void Interact()
 {
     if (behaviour)
     {
         if (isNetworkedOwner)
         {
             behaviour.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.Owner, eventName);
         }
         else if (isNetworkedAll)
         {
             behaviour.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, eventName);
         }
         else
         {
             behaviour.SendCustomEvent(eventName);
         }
     }
 }
예제 #7
0
 public void SendEvent() //the event sending out the udonbehaviour event.
 {
     if (networkEvent)
     {
         udonBehaviour.SendCustomNetworkEvent(target, eventName);
     }
     else
     {
         udonBehaviour.SendCustomEvent(eventName);
     }
 }
예제 #8
0
    void Update()
    {
        for (int i = 0; i <= lastActiveEvent; i++)
        {
            float d = delays[i];

            if (i == lastActiveEvent && d == 0f)
            {
                lastActiveEvent--;
            }

            else if (d > 0f && Time.realtimeSinceStartup > d)
            {
                // Send event
                UdonBehaviour targetUdon  = (UdonBehaviour)targets[i];
                string        eventName   = events[i];
                string        networkMode = networkModes[i];
                switch (networkMode)
                {
                case "Local":
                    targetUdon.SendCustomEvent(eventName);
                    break;

                case "All":
                    targetUdon.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, eventName);
                    break;

                case "Owner":
                    targetUdon.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.Owner, eventName);
                    break;
                }

                // Reset slot
                delays[i]       = 0f;
                targets[i]      = null;
                events[i]       = null;
                networkModes[i] = null;
            }
        }
    }
예제 #9
0
    private void Execute()
    {
        if (ownershipControl == 1)
        {
#if UNITY_EDITOR
            // local simulation
            udonBehaviour.SendCustomEvent(method);
#else
            udonBehaviour.SendCustomNetworkEvent(NetworkEventTarget.Owner, method);
#endif
        }
        else
        {
            udonBehaviour.SendCustomEvent(method);
        }
    }
예제 #10
0
    public VRC.Udon.Common.Interfaces.NetworkEventTarget target; //if using a network event who the target will be.

    public void Submit()                                         //the event sending out the udonbehaviour event.
    {
        if (inputfield.text == password)
        {
            if (networkEvent)
            {
                udonBehaviour.SendCustomNetworkEvent(target, eventName);
            }
            else
            {
                udonBehaviour.SendCustomEvent(eventName);
            }
        }
        else
        {
            inputfield.text = string.Empty;
        }
    }
 public override void OnPickupUseDown()
 {
     derpyGun.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, "OnGunTriggerDown");
 }
예제 #12
0
 void Interact()
 {
     udonBehaviour.SetProgramVariable("testval", !testval);
     udonBehaviour.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, "netobj");
 }
 public override void OnPickup()
 {
     derpyGun.SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, "OnSecondaryHoldPickup");
 }