mirror of
https://github.com/MrUnknownDE/vcc-tools.git
synced 2026-04-15 14:03:44 +02:00
add ProTV Room Zone Script :D
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "de.mrunknownde.gittool.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
170
ProTV/ProTVRoomZone.asset
Normal file
170
ProTV/ProTVRoomZone.asset
Normal file
@@ -0,0 +1,170 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||
m_Name: ProTVRoomZone
|
||||
m_EditorClassIdentifier:
|
||||
serializedUdonProgramAsset: {fileID: 11400000, guid: 7f1b25a7785724b4a80dabaacffcc775,
|
||||
type: 2}
|
||||
udonAssembly:
|
||||
assemblyError:
|
||||
sourceCsScript: {fileID: 11500000, guid: 48ee0805fb47e2e4494f694b970678c1, type: 3}
|
||||
scriptVersion: 2
|
||||
compiledVersion: 2
|
||||
behaviourSyncMode: 0
|
||||
hasInteractEvent: 0
|
||||
scriptID: -2239841375030423733
|
||||
serializationData:
|
||||
SerializedFormat: 2
|
||||
SerializedBytes:
|
||||
ReferencedUnityObjects: []
|
||||
SerializedBytesString:
|
||||
Prefab: {fileID: 0}
|
||||
PrefabModificationsReferencedUnityObjects: []
|
||||
PrefabModifications: []
|
||||
SerializationNodes:
|
||||
- Name: fieldDefinitions
|
||||
Entry: 7
|
||||
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
|
||||
UdonSharp.Editor]], mscorlib
|
||||
- Name: comparer
|
||||
Entry: 7
|
||||
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
|
||||
mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 2
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: localVideoPlayer
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: localVideoPlayer
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 3|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.GameObject, UnityEngine.CoreModule
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 3
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
- Name:
|
||||
Entry: 6
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <IsSerialized>k__BackingField
|
||||
Entry: 5
|
||||
Data: true
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
|
||||
- Name: header
|
||||
Entry: 1
|
||||
Data: "Der Videoplayer f\xFCr diesen Raum"
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 13
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: roomCollider
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: roomCollider
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 7|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.BoxCollider, UnityEngine.PhysicsModule
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 7
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
- Name:
|
||||
Entry: 6
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <IsSerialized>k__BackingField
|
||||
Entry: 5
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
- Name:
|
||||
Entry: 13
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 13
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
56
ProTV/ProTVRoomZone.cs
Normal file
56
ProTV/ProTVRoomZone.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* ============================================================================
|
||||
* ProTV Room Zone Manager
|
||||
* ============================================================================
|
||||
* Ein autarkes Trigger-Modul zur ressourcenschonenden Steuerung von
|
||||
* ProTV / AVPro Instanzen in VRChat
|
||||
*
|
||||
* written by MrUnknownDE
|
||||
* https://mrunknown.de
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon;
|
||||
|
||||
public class ProTVRoomZone : UdonSharpBehaviour
|
||||
{
|
||||
[Header("Der Videoplayer für diesen Raum")]
|
||||
public GameObject localVideoPlayer;
|
||||
|
||||
private BoxCollider roomCollider;
|
||||
|
||||
void Start()
|
||||
{
|
||||
roomCollider = GetComponent<BoxCollider>();
|
||||
SendCustomEventDelayedSeconds(nameof(CheckSpawnPosition), 2.0f);
|
||||
}
|
||||
|
||||
public void CheckSpawnPosition()
|
||||
{
|
||||
VRCPlayerApi player = Networking.LocalPlayer;
|
||||
if (!Utilities.IsValid(player)) return;
|
||||
if (roomCollider != null && roomCollider.bounds.Contains(player.GetPosition()))
|
||||
{
|
||||
if (localVideoPlayer != null) localVideoPlayer.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (localVideoPlayer != null) localVideoPlayer.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerTriggerEnter(VRCPlayerApi player)
|
||||
{
|
||||
if (!Utilities.IsValid(player) || !player.isLocal) return;
|
||||
if (localVideoPlayer != null) localVideoPlayer.SetActive(true);
|
||||
}
|
||||
|
||||
public override void OnPlayerTriggerExit(VRCPlayerApi player)
|
||||
{
|
||||
if (!Utilities.IsValid(player) || !player.isLocal) return;
|
||||
if (localVideoPlayer != null) localVideoPlayer.SetActive(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user