public override void OnPlayerTriggerEnter(VRCPlayerApi player) { if (Networking.LocalPlayer.playerId == player.playerId) { behaviour.SendCustomEvent(onEnterEvent); } }
private void OnPlayerEnter() { //Debug.Log("<color=green>[THH_PlayerTriggers]</color>: Event 'OnPlayerEnter' on " + gameObject.name); if (MessageReceiver != null) { MessageReceiver.SendCustomEvent("OnPlayerEnter"); } }
void UpdateScreenMaterial(int mode) { Texture sourceTexture = _videoRenderTex; int avPro = 0; _localScreenMode = mode; #if !UNITY_EDITOR if (mode == SCREEN_MODE_LOGO && logoTexture != null) { sourceTexture = logoTexture; } else if (mode == SCREEN_MODE_TRANSITION && loopTexture != null) { sourceTexture = loopTexture; } else if (_localScreenMode == SCREEN_MODE_ERROR_BLOCKED && errorBlockedTexture != null) { sourceTexture = errorBlockedTexture; } else if (currentPlayerMode == PLAYER_MODE_STREAM) { sourceTexture = streamRTSource.sharedMaterial.GetTexture("_MainTex"); if (sourceTexture == null) { sourceTexture = logoTexture; } else { avPro = 1; } } #endif if (videoControlHandler != null) { if (mode == SCREEN_MODE_NORMAL) { videoControlHandler.SendCustomEvent("PlayerStart"); } else { videoControlHandler.SendCustomEvent("PlayerStop"); } } Material screenMaterial = screenRenderer.sharedMaterial; screenMaterial.SetTexture("_EmissionMap", sourceTexture); screenMaterial.SetInt("_IsAVProInput", avPro); for (int i = 0; i < extraScreenMaterials.Length; i++) { screenMaterial = extraScreenMaterials[i]; string name = extraScreenMaterialProps[i]; screenMaterial.SetTexture(name, sourceTexture); screenMaterial.SetInt("_IsAVProInput", avPro); } }
private void UpdateAdapter(Component c) { UdonBehaviour u = (UdonBehaviour)c; u.SetProgramVariable("local_bool", local_bool); u.SendCustomEvent("SetAdapterBool"); u.SetProgramVariable("local_float", local_float); u.SendCustomEvent("SetAdapterFloat"); }
public virtual void OnPlayerJoined(VRC.SDKBase.VRCPlayerApi player) { if (player.displayName == userName) { if (player.isLocal || !localOnly) { udonBehaviour.SendCustomEvent(eventName); } } }
private void OnTriggerEnter(Collider other) { for (int i = 0; i < keys.Length; i++) { if (other == keys[i]) { udonBehaviour.SendCustomEvent(eventName); break; } } }
public static void SendCustomNetworkEventHook(UdonBehaviour behaviour, NetworkEventTarget target, string eventName) { if (string.IsNullOrEmpty(eventName)) { return; } if (eventName[0] == '_') { behaviour.LogError("Did not send custom network event \"" + eventName + "\". Events starting " + "with an underscore may not be run remotely. " + VRC.Tools.GetGameObjectPath(behaviour.gameObject)); return; } if (target == NetworkEventTarget.All || (target == NetworkEventTarget.Owner && Networking.IsOwner(behaviour.gameObject))) { behaviour.Log("Sending Network Event! eventName:" + eventName + ", obj:" + VRC.Tools.GetGameObjectPath(behaviour.gameObject)); behaviour.SendCustomEvent(eventName); } else { behaviour.LogWarning("Did not send custom network event " + eventName + " for object at " + VRC.Tools.GetGameObjectPath(behaviour.gameObject)); } }
public void SetBool() { if (udonBehaviour) { udonBehaviour.SetProgramVariable(variableName, value); if (UpdateMethod != string.Empty) { udonBehaviour.SendCustomEvent(UpdateMethod); } } if (toggle) { if (toggle.isOn != value) { toggleInitialize = false; toggle.isOn = value; toggleInitialize = true; } } if (display) { display.text = value.ToString(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); CyanEmuUdonHelper udonHelper = target as CyanEmuUdonHelper; CyanEmuSyncableEditorHelper.DisplaySyncOptions(udonHelper); UdonBehaviour udonBehaviour = udonHelper.GetUdonBehaviour(); // TODO set public variables expand_ = EditorGUILayout.Foldout(expand_, "Run Custom Event"); if (expand_) { foreach (string eventName in udonBehaviour.GetPrograms()) { if (GUILayout.Button(eventName)) { udonBehaviour.SendCustomEvent(eventName); } } } }
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); } }
private void OnTriggerEnter(Collider other) { // プレイヤーに触れてリングが有効であれば if (other.GetType() == typeof(CharacterController) && isActive) { // 当たったプレイヤーのローカルで処理をおこなう // 当たったプレイヤーがどのコントローラを持っているか // 当たったプレイヤーが持つコントローラのエネルギーを満タンにする if (Networking.IsOwner(controller1.gameObject)) { controller1.SendCustomEvent("ChargeEnergyToFull"); } if (Networking.IsOwner(controller2.gameObject)) { controller2.SendCustomEvent("ChargeEnergyToFull"); } if (Networking.IsOwner(controller3.gameObject)) { controller3.SendCustomEvent("ChargeEnergyToFull"); } if (Networking.IsOwner(controller4.gameObject)) { controller4.SendCustomEvent("ChargeEnergyToFull"); } // リングにあたったエフェクトを全員に同期させるように発生させる SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, "PlayParticle"); // インスタンスのMaster内だけで再チャージ処理をおこなう SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.Owner, "SetRecast"); // 全員に同期させるようにチャージ可能であることを示すエフェクトを消す SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, "InactiveChargeRing"); } }
// リセット public void Reset() { selected = 0; state = 0; targetik = true; character.Emote(0, 0f); // 表情変更 なし character.Move3(Vector3.zero, 0); // アニメーション停止 agent.transform.position = _rusk_home_point.position; // おうちに瞬間移動 agent.SetDestination(agent.transform.position); ashioto(false); for (var i = 0; i < _tgroot.transform.childCount; i++) { GameObject ball = _tgroot.transform.GetChild(i).gameObject; if (ball != null && ball.activeSelf) { UdonBehaviour udon = (UdonBehaviour)ball.GetComponent(typeof(UdonBehaviour)); if (udon != null) { udon.SendCustomEvent("BallReset"); // ボール状態リセット } } } }
public void logout() { displayProgram.resetDisplay(); // disable / enable all objects on logout // actually, all it does is flip them opposite of their granted state if (changeActiveStatesOnLogout) { for (int i = 0; i < doorObjects.Length; i++) { // not the settings obj, and not null! good! if ((doorObjects[i] != settingsObj) && (doorObjects[i] != null)) { // make sure active bool exists for this object if ((setActiveBools.Length - 1) >= i) { Debug.Log("Keypad logout: " + doorObjects[i].name + ".setActive(" + !setActiveBools[i] + ")"); doorObjects[i].SetActive(!setActiveBools[i]); } else { // default behavior Debug.Log("Keypad logout: " + doorObjects[i].name + ".setActive(true)"); doorObjects[i].SetActive(true); } } } } if (programClosed != null) { programClosed.SendCustomEvent("keypadClosed"); } }
void ProcessPayload() { Component[] receiverComponents = transform.parent.GetComponents(typeof(UdonBehaviour)); int componentIndex = System.Int32.Parse((string)EVENT_ARRAY.GetValue(2)); if (componentIndex < receiverComponents.GetLowerBound(0) || componentIndex > receiverComponents.GetUpperBound(0)) { Debug.Log("[SE_Handler] Error: Component index " + componentIndex + " is out of bounds"); return; } UdonBehaviour receiverUdon = (UdonBehaviour)receiverComponents.GetValue(componentIndex); if (receiverUdon == null) { Debug.Log("[SE_Handler] Error: Could not access UdonBehaviour at index " + componentIndex); return; } if (EVENT_ARRAY.Length == 6) { string parametersString = (string)EVENT_ARRAY.GetValue(5); string[] parametersArray = parametersString.Split('|'); receiverUdon.SetProgramVariable("PARAMS", parametersArray); } string udonEventName = (string)EVENT_ARRAY.GetValue(4); receiverUdon.SendCustomEvent(udonEventName); }
void Update() { if (Working) { if (ParkingTimer <= 0) // Not in parking mode { var playerPos = Networking.LocalPlayer.GetPosition(); ControlTarget.position = playerPos + OffsetVector; } else { ParkingTimer -= Time.deltaTime; if (ParkingTimer <= 0) { // Stop working when ParkingTimer expired. EXUR_Handler.SendCustomEvent("ReleaseObject"); } else if (ParkingTimer <= ParkingDuration * 0.1f) { // At end of ParkingDuration, go back to original position ConstraintSrc.position = ConstraintSrcOrgPos; } } } }
private void scoreDamage(int damage) { if (_scoreCountable == null) { return; } // it will be die. if (_hp <= damage) { _scoreCountable.SendCustomEvent("ScoreZombieKill"); } else { _scoreCountable.SendCustomEvent("ScoreZombieDamage"); } }
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); } }
public void SetInt() { if (udonBehaviour) { udonBehaviour.SetProgramVariable(variableName, value); if (UpdateMethod != string.Empty) { udonBehaviour.SendCustomEvent(UpdateMethod); } } if (slider) { if (slider.value != value) { sliderInitialize = false; slider.value = value; sliderInitialize = true; } } if (display) { display.text = value.ToString(); } }
private void OnParticleCollision(GameObject other) { Debug.Log($"HitDetector: Particle has collided with {player.displayName}!"); if (eventReciever != null && !string.IsNullOrEmpty(eventName)) { Debug.Log("HitDetector: Sending event to reciever."); eventReciever.SendCustomEvent(eventName); } }
public void SendEvent() //the event sending out the udonbehaviour event. { if (networkEvent) { udonBehaviour.SendCustomNetworkEvent(target, eventName); } else { udonBehaviour.SendCustomEvent(eventName); } }
public static void SendCustomNetworkEventHook(UdonBehaviour behaviour, NetworkEventTarget target, string eventName) { if (target == NetworkEventTarget.All || (target == NetworkEventTarget.Owner && Networking.IsOwner(behaviour.gameObject))) { behaviour.Log("Sending Network Event! eventName:" + eventName + ", obj:" + VRC.Tools.GetGameObjectPath(behaviour.gameObject)); behaviour.SendCustomEvent(eventName); } else { behaviour.Log("Did not send custom network event " + eventName + " for object at " + VRC.Tools.GetGameObjectPath(behaviour.gameObject)); } }
public void Run_event_0_NET() { for (uint i = 0; i < Udon_scripts_0.Length; i++) { UdonBehaviour temp = (UdonBehaviour)Udon_scripts_0[i].GetComponent(typeof(UdonBehaviour)); if (temp != null) { temp.SendCustomEvent(Event_Name_0[i]); } } current_state = false; }
void SendEvent(Handler eventSource, string eventName, string eventInfo) { if (EventListener) { EventListener.SetProgramVariable(nameof(ManagerListener.EXUR_EventSource), eventSource); EventListener.SetProgramVariable(nameof(ManagerListener.EXUR_EventName), eventName); EventListener.SetProgramVariable(nameof(ManagerListener.EXUR_EventAdditionalInfo), eventInfo); EventListener.SendCustomEvent(nameof(ManagerListener.EXUR_ReceiveEvent)); // TODO read variable to check variable exists in user program as kind debug mode (?) } }
private void attack() { if (_isDamageFrame) { var targetVec = getTargetVec(); if (_healthManager != null && isInAttackRange(targetVec)) { _healthManager.SendCustomEvent("Damage"); } _isDamageFrame = false; } return; }
/// <summary> /// Triggers Serialization of the manually synced player id. /// Does nothing if the caller does not own this behaviour/gameobject. /// </summary> /// <returns>false if the local player is not the owner or anything goes wrong</returns> public bool UpdateForAll() { var localPlayer = VRC.SDKBase.Networking.LocalPlayer; if (!Utilities.IsValid(targetBehaviour) || !Utilities.IsValid(localPlayer) || !localPlayer.IsOwner(gameObject)) { return(false); } if (!string.IsNullOrEmpty(targetPreSerialization)) { targetBehaviour.SendCustomEvent(targetPreSerialization); } var value = targetBehaviour.GetProgramVariable(targetVariable); if (value == null) { Debug.LogError( $"SyncedInteger.UpdateForAll: '{targetVariable}' does not exist in '{targetBehaviour.name}'", this); return(false); } // ReSharper disable once OperatorIsCanBeUsed if (value.GetType() == typeof(int)) { syncedValue = (int)value; UpdateOldValueAndTriggerChangeEvent(); RequestSerialization(); return(true); } Debug.LogError( $"SyncedInteger.UpdateForAll: '{targetVariable}' in '{targetBehaviour.name}' is not an integer", this); return(false); }
public void Explode() { TargetAnimator.SetTrigger("explode"); HitPoints = FullHealth; foreach (GameObject Exploder in ExplodeOther) { UdonBehaviour ExploderUdon = (UdonBehaviour)Exploder.GetComponent(typeof(UdonBehaviour)); if (ExploderUdon != null) { ExploderUdon.SendCustomEvent("Explode"); } } }
public void Accept() { if (acceptBehaviour != null && acceptMethod != null) { if (acceptParam != null) { acceptBehaviour.SetProgramVariable(acceptMethod + "_param0", acceptParam); } acceptBehaviour.SendCustomEvent(acceptMethod); } animator.SetTrigger("close"); animator.ResetTrigger("close"); }
public void Deny() { if (denyBehaviour != null && denyMethod != null) { if (denyParam != null) { denyBehaviour.SetProgramVariable(denyMethod + "_param0", denyParam); } denyBehaviour.SendCustomEvent(denyMethod); } animator.SetTrigger("close"); animator.ResetTrigger("close"); }
public void UpdateSettings() { // Update labels gainLabel.text = "Gain: " + ((int)Remap(gainSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; trebleLabel.text = "Treble: " + ((int)Remap(trebleSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; bassLabel.text = "Bass: " + ((int)Remap(bassSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; // Update Sliders var anchor0 = new Vector2(x0Slider.value, 1f); var anchor1 = new Vector2(x1Slider.value, 1f); var anchor2 = new Vector2(x2Slider.value, 1f); var anchor3 = new Vector2(x3Slider.value, 1f); _threshold0Rect.anchorMin = anchor0; _threshold0Rect.anchorMax = anchor1; _threshold1Rect.anchorMin = anchor1; _threshold1Rect.anchorMax = anchor2; _threshold2Rect.anchorMin = anchor2; _threshold2Rect.anchorMax = anchor3; _threshold3Rect.anchorMin = anchor3; // threshold3Rect.anchorMax is a constant value. Skip // General settings audioLink.SetProgramVariable("gain", gainSlider.value); audioLink.SetProgramVariable("treble", trebleSlider.value); audioLink.SetProgramVariable("bass", bassSlider.value); audioLink.SetProgramVariable("fadeLength", fadeLengthSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); // Crossover settings audioLink.SetProgramVariable("x0", x0Slider.value); audioLink.SetProgramVariable("x1", x1Slider.value); audioLink.SetProgramVariable("x2", x2Slider.value); audioLink.SetProgramVariable("x3", x3Slider.value); audioLink.SetProgramVariable("threshold0", threshold0Slider.value); audioLink.SetProgramVariable("threshold1", threshold1Slider.value); audioLink.SetProgramVariable("threshold2", threshold2Slider.value); audioLink.SetProgramVariable("threshold3", threshold3Slider.value); audioSpectrumDisplay.SetFloat("_X0", x0Slider.value); audioSpectrumDisplay.SetFloat("_X1", x1Slider.value); audioSpectrumDisplay.SetFloat("_X2", x2Slider.value); audioSpectrumDisplay.SetFloat("_X3", x3Slider.value); audioSpectrumDisplay.SetFloat("_Threshold0", threshold0Slider.value); audioSpectrumDisplay.SetFloat("_Threshold1", threshold1Slider.value); audioSpectrumDisplay.SetFloat("_Threshold2", threshold2Slider.value); audioSpectrumDisplay.SetFloat("_Threshold3", threshold3Slider.value); audioLink.SendCustomEvent("UpdateSettings"); }
//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 }