merge
commit
eaf80a2dff
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8adda10125f861c4ab834bb9bd2056b5
|
guid: b34f6c4b68ec079449bfb4be05fbfec7
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ public class MouseDragger : MonoBehaviour
|
||||||
{
|
{
|
||||||
foreach (string draggableTag in draggableTags)
|
foreach (string draggableTag in draggableTags)
|
||||||
{
|
{
|
||||||
if (hit.transform.CompareTag(draggableTag) || hit.transform.parent == null || hit.transform.parent.CompareTag(draggableTag))
|
if (hit.transform.CompareTag(draggableTag) || (hit.transform.parent != null && hit.transform.parent.CompareTag(draggableTag)))
|
||||||
{
|
{
|
||||||
NetworkObject netObj = hit.transform.GetComponent<NetworkObject>();
|
NetworkObject netObj = hit.transform.GetComponent<NetworkObject>();
|
||||||
netObj ??= hit.transform.GetComponentInParent<NetworkObject>();
|
netObj ??= hit.transform.GetComponentInParent<NetworkObject>();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
using Dissonance;
|
using Dissonance;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
|
|
@ -8,22 +10,16 @@ namespace VelNet
|
||||||
{
|
{
|
||||||
public class NetworkGUI : MonoBehaviour
|
public class NetworkGUI : MonoBehaviour
|
||||||
{
|
{
|
||||||
[FormerlySerializedAs("networkManager")] public VelNetManager velNetManager;
|
[FormerlySerializedAs("networkManager")]
|
||||||
|
public VelNetManager velNetManager;
|
||||||
|
|
||||||
public InputField userInput;
|
public InputField userInput;
|
||||||
public InputField sendInput;
|
public InputField sendInput;
|
||||||
public InputField roomInput;
|
public InputField roomInput;
|
||||||
public Text messages;
|
public Text messages;
|
||||||
public List<string> messageBuffer;
|
public List<string> messageBuffer;
|
||||||
public Dropdown microphones;
|
public Dropdown microphones;
|
||||||
DissonanceComms comms;
|
private DissonanceComms comms;
|
||||||
|
|
||||||
public void HandleSend()
|
|
||||||
{
|
|
||||||
if (sendInput.text != "")
|
|
||||||
{
|
|
||||||
VelNetManager.SendTo(VelNetManager.MessageType.OTHERS, sendInput.text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleLogin()
|
public void HandleLogin()
|
||||||
{
|
{
|
||||||
|
|
@ -33,6 +29,14 @@ namespace VelNet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HandleGetRooms()
|
||||||
|
{
|
||||||
|
if (VelNetManager.instance.connected)
|
||||||
|
{
|
||||||
|
VelNetManager.GetRooms();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleJoin()
|
public void HandleJoin()
|
||||||
{
|
{
|
||||||
if (roomInput.text != "")
|
if (roomInput.text != "")
|
||||||
|
|
@ -51,23 +55,17 @@ namespace VelNet
|
||||||
{
|
{
|
||||||
comms = FindObjectOfType<DissonanceComms>();
|
comms = FindObjectOfType<DissonanceComms>();
|
||||||
microphones.AddOptions(new List<string>(Microphone.devices));
|
microphones.AddOptions(new List<string>(Microphone.devices));
|
||||||
VelNetManager.MessageReceived += (m) =>
|
|
||||||
{
|
|
||||||
string s = m.type + ":" + m.sender + ":" + m.text;
|
|
||||||
messageBuffer.Add(s);
|
|
||||||
messages.text = "";
|
|
||||||
|
|
||||||
|
StartCoroutine(testes());
|
||||||
|
}
|
||||||
|
|
||||||
if (messageBuffer.Count > 10)
|
IEnumerator testes()
|
||||||
{
|
{
|
||||||
messageBuffer.RemoveAt(0);
|
yield return new WaitForSeconds(1.0f);
|
||||||
}
|
HandleLogin();
|
||||||
|
yield return new WaitForSeconds(1.0f);
|
||||||
foreach (string msg in messageBuffer)
|
HandleJoin();
|
||||||
{
|
yield return null;
|
||||||
messages.text = messages.text + msg + "\n";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleMicrophoneSelection()
|
public void handleMicrophoneSelection()
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,30 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
namespace VelNet
|
namespace VelNet
|
||||||
{
|
{
|
||||||
public class PlayerController : NetworkComponent
|
public class PlayerController : NetworkSerializedObjectStream
|
||||||
{
|
{
|
||||||
public Vector3 targetPosition;
|
private Renderer rend;
|
||||||
public Quaternion targetRotation;
|
public Color color;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
rend = GetComponent<MeshRenderer>();
|
||||||
|
if (IsMine)
|
||||||
|
{
|
||||||
|
color = new Color(Random.Range(0, 1f), Random.Range(0, 1f), Random.Range(0, 1f));
|
||||||
|
rend.material.color = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
// if (!IsMine)
|
|
||||||
// {
|
|
||||||
// transform.position = Vector3.Lerp(transform.position, targetPosition, .1f);
|
|
||||||
// transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, .1f);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
if (IsMine)
|
if (IsMine)
|
||||||
{
|
{
|
||||||
Vector3 movement = new Vector3();
|
Vector3 movement = new Vector3();
|
||||||
|
|
@ -43,37 +48,35 @@ namespace VelNet
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Backspace))
|
if (Input.GetKeyDown(KeyCode.Backspace))
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, NetworkObject> kvp in VelNetManager.instance.objects.Where(kvp => !kvp.Value.ownershipLocked))
|
foreach (string key in VelNetManager.instance.objects
|
||||||
|
.Where(kvp => !kvp.Value.ownershipLocked)
|
||||||
|
.Select(kvp => kvp.Key).ToArray())
|
||||||
{
|
{
|
||||||
VelNetManager.NetworkDestroy(kvp.Key);
|
VelNetManager.NetworkDestroy(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
protected override void SendState(BinaryWriter binaryWriter)
|
||||||
// protected override byte[] SendState()
|
|
||||||
// {
|
|
||||||
// using MemoryStream mem = new MemoryStream();
|
|
||||||
// using BinaryWriter writer = new BinaryWriter(mem);
|
|
||||||
//
|
|
||||||
// writer.Write(transform.position);
|
|
||||||
// writer.Write(transform.rotation);
|
|
||||||
//
|
|
||||||
// return mem.ToArray();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// protected override void ReceiveState(byte[] message)
|
|
||||||
// {
|
|
||||||
// using MemoryStream mem = new MemoryStream(message);
|
|
||||||
// using BinaryReader reader = new BinaryReader(mem);
|
|
||||||
//
|
|
||||||
// targetPosition = reader.ReadVector3();
|
|
||||||
// targetRotation = reader.ReadQuaternion();
|
|
||||||
// }
|
|
||||||
public override void ReceiveBytes(byte[] message)
|
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
binaryWriter.Write(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ReceiveState(BinaryReader binaryReader)
|
||||||
|
{
|
||||||
|
// Color newColor = binaryReader.ReadColor();
|
||||||
|
Color newColor;
|
||||||
|
newColor.r = binaryReader.ReadSingle();
|
||||||
|
newColor.g = binaryReader.ReadSingle();
|
||||||
|
newColor.b = binaryReader.ReadSingle();
|
||||||
|
newColor.a = binaryReader.ReadSingle();
|
||||||
|
if (newColor != color)
|
||||||
|
{
|
||||||
|
rend.material.color = newColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
color = newColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,86 @@
|
||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &2802320351940726854
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6602982999811082154}
|
||||||
|
- component: {fileID: 6433756913090684124}
|
||||||
|
- component: {fileID: 6919422133110223353}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Dissonance Range
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &6602982999811082154
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2802320351940726854}
|
||||||
|
m_LocalRotation: {x: -0.70710635, y: -0, z: -0, w: 0.7071073}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 8, y: 0.1, z: 8}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 3076416102083120807}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
|
||||||
|
--- !u!33 &6433756913090684124
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2802320351940726854}
|
||||||
|
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &6919422133110223353
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2802320351940726854}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 6fad1ca32acea73489c2c4b898cdb9d4, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
--- !u!1 &6139051692386484099
|
--- !u!1 &6139051692386484099
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -33,7 +114,8 @@ Transform:
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||||
m_Children: []
|
m_Children:
|
||||||
|
- {fileID: 6602982999811082154}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|
@ -113,12 +195,13 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
ownershipLocked: 1
|
ownershipLocked: 1
|
||||||
networkId:
|
networkId:
|
||||||
|
sceneNetworkId: 0
|
||||||
prefabName:
|
prefabName:
|
||||||
isSceneObject: 0
|
isSceneObject: 0
|
||||||
syncedComponents:
|
syncedComponents:
|
||||||
- {fileID: -4404668399269848200}
|
- {fileID: -4404668399269848200}
|
||||||
- {fileID: 7564913803199044469}
|
|
||||||
- {fileID: 1181612843795795320}
|
- {fileID: 1181612843795795320}
|
||||||
|
- {fileID: 7564913803199044469}
|
||||||
--- !u!114 &-4404668399269848200
|
--- !u!114 &-4404668399269848200
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -132,8 +215,9 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
networkObject: {fileID: 9102273340480352682}
|
networkObject: {fileID: 9102273340480352682}
|
||||||
targetPosition: {x: 0, y: 0, z: 0}
|
serializationRateHz: 30
|
||||||
targetRotation: {x: 0, y: 0, z: 0, w: 0}
|
hybridOnChangeCompression: 1
|
||||||
|
color: {r: 0, g: 0, b: 0, a: 0}
|
||||||
--- !u!114 &1181612843795795320
|
--- !u!114 &1181612843795795320
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -147,9 +231,10 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
networkObject: {fileID: 9102273340480352682}
|
networkObject: {fileID: 9102273340480352682}
|
||||||
|
useTcp: 0
|
||||||
dissonanceID:
|
dissonanceID:
|
||||||
closePlayers:
|
closePlayers:
|
||||||
maxDistance: 0
|
maxDistance: 2
|
||||||
--- !u!114 &7564913803199044469
|
--- !u!114 &7564913803199044469
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -163,7 +248,8 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
networkObject: {fileID: 9102273340480352682}
|
networkObject: {fileID: 9102273340480352682}
|
||||||
serializationRateHz: 30
|
serializationRateHz: 60
|
||||||
targetPosition: {x: 0, y: 0, z: 0}
|
hybridOnChangeCompression: 1
|
||||||
targetRotation: {x: 0, y: 0, z: 0, w: 0}
|
useLocalTransform: 0
|
||||||
smoothness: 0.1
|
teleportDistance: 0
|
||||||
|
teleportAngle: 0
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,9 @@ public class SyncedTextbox : NetworkSerializedObjectStream
|
||||||
{
|
{
|
||||||
text.text = binaryReader.ReadString();
|
text.text = binaryReader.ReadString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TakeOwnership()
|
||||||
|
{
|
||||||
|
networkObject.TakeOwnership();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,100 @@
|
||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &6003361529827848619
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7099230484513283147}
|
||||||
|
- component: {fileID: 8811139817265458480}
|
||||||
|
- component: {fileID: 3776025769317911085}
|
||||||
|
- component: {fileID: 1426238303320144522}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Cube
|
||||||
|
m_TagString: TestSphere
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &7099230484513283147
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6003361529827848619}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8565720275311462455}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &8811139817265458480
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6003361529827848619}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &3776025769317911085
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6003361529827848619}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!65 &1426238303320144522
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6003361529827848619}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &8565720275311462453
|
--- !u!1 &8565720275311462453
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -13,7 +108,7 @@ GameObject:
|
||||||
- component: {fileID: 8565720275311462452}
|
- component: {fileID: 8565720275311462452}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: TestNetworkedGameObject
|
m_Name: TestNetworkedGameObject
|
||||||
m_TagString: TestSphere
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|
@ -29,7 +124,7 @@ Transform:
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 8565720276181857624}
|
- {fileID: 7099230484513283147}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|
@ -66,99 +161,7 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
networkObject: {fileID: 3951900052977689805}
|
networkObject: {fileID: 3951900052977689805}
|
||||||
serializationRateHz: 60
|
serializationRateHz: 60
|
||||||
|
hybridOnChangeCompression: 1
|
||||||
useLocalTransform: 0
|
useLocalTransform: 0
|
||||||
--- !u!1 &8565720276181857625
|
teleportDistance: 0
|
||||||
GameObject:
|
teleportAngle: 0
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 8565720276181857624}
|
|
||||||
- component: {fileID: 8565720276181857605}
|
|
||||||
- component: {fileID: 8565720276181857626}
|
|
||||||
- component: {fileID: 8565720276181857627}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Sphere
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &8565720276181857624
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 8565720276181857625}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 8565720275311462455}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!33 &8565720276181857605
|
|
||||||
MeshFilter:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 8565720276181857625}
|
|
||||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
--- !u!23 &8565720276181857626
|
|
||||||
MeshRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 8565720276181857625}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 1
|
|
||||||
m_ReceiveShadows: 1
|
|
||||||
m_DynamicOccludee: 1
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 1
|
|
||||||
m_ReflectionProbeUsage: 1
|
|
||||||
m_RayTracingMode: 2
|
|
||||||
m_RayTraceProcedural: 0
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_RendererPriority: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
|
||||||
m_StaticBatchInfo:
|
|
||||||
firstSubMesh: 0
|
|
||||||
subMeshCount: 0
|
|
||||||
m_StaticBatchRoot: {fileID: 0}
|
|
||||||
m_ProbeAnchor: {fileID: 0}
|
|
||||||
m_LightProbeVolumeOverride: {fileID: 0}
|
|
||||||
m_ScaleInLightmap: 1
|
|
||||||
m_ReceiveGI: 1
|
|
||||||
m_PreserveUVs: 0
|
|
||||||
m_IgnoreNormalsForChartDetection: 0
|
|
||||||
m_ImportantGI: 0
|
|
||||||
m_StitchLightmapSeams: 1
|
|
||||||
m_SelectedEditorRenderState: 3
|
|
||||||
m_MinimumChartSize: 4
|
|
||||||
m_AutoUVMaxDistance: 0.5
|
|
||||||
m_AutoUVMaxAngle: 89
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 0
|
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
|
||||||
--- !u!135 &8565720276181857627
|
|
||||||
SphereCollider:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 8565720276181857625}
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Radius: 0.5
|
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: TransparentMat
|
||||||
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: 3000
|
||||||
|
stringTagMap:
|
||||||
|
RenderType: Transparent
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 10
|
||||||
|
- _GlossMapScale: 1
|
||||||
|
- _Glossiness: 0.5
|
||||||
|
- _GlossyReflections: 0
|
||||||
|
- _Metallic: 0
|
||||||
|
- _Mode: 3
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.02
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 0
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _UVSec: 0
|
||||||
|
- _ZWrite: 0
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 0.03137255}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6fad1ca32acea73489c2c4b898cdb9d4
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 009dc4ba29f14b649beb8c3eaad89f15
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d1b34f106c04378428823df374b0e07c
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 112000000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!29 &1
|
||||||
|
OcclusionCullingSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_OcclusionBakeSettings:
|
||||||
|
smallestOccluder: 5
|
||||||
|
smallestHole: 0.25
|
||||||
|
backfaceThreshold: 100
|
||||||
|
m_SceneGUID: 00000000000000000000000000000000
|
||||||
|
m_OcclusionCullingData: {fileID: 0}
|
||||||
|
--- !u!104 &2
|
||||||
|
RenderSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 9
|
||||||
|
m_Fog: 0
|
||||||
|
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||||
|
m_FogMode: 3
|
||||||
|
m_FogDensity: 0.01
|
||||||
|
m_LinearFogStart: 0
|
||||||
|
m_LinearFogEnd: 300
|
||||||
|
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||||
|
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||||
|
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||||
|
m_AmbientIntensity: 1
|
||||||
|
m_AmbientMode: 0
|
||||||
|
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||||
|
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_HaloStrength: 0.5
|
||||||
|
m_FlareStrength: 1
|
||||||
|
m_FlareFadeSpeed: 3
|
||||||
|
m_HaloTexture: {fileID: 0}
|
||||||
|
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_DefaultReflectionMode: 0
|
||||||
|
m_DefaultReflectionResolution: 128
|
||||||
|
m_ReflectionBounces: 1
|
||||||
|
m_ReflectionIntensity: 1
|
||||||
|
m_CustomReflection: {fileID: 0}
|
||||||
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
||||||
|
m_UseRadianceAmbientProbe: 0
|
||||||
|
--- !u!157 &3
|
||||||
|
LightmapSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 12
|
||||||
|
m_GIWorkflowMode: 1
|
||||||
|
m_GISettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_BounceScale: 1
|
||||||
|
m_IndirectOutputScale: 1
|
||||||
|
m_AlbedoBoost: 1
|
||||||
|
m_EnvironmentLightingMode: 0
|
||||||
|
m_EnableBakedLightmaps: 1
|
||||||
|
m_EnableRealtimeLightmaps: 0
|
||||||
|
m_LightmapEditorSettings:
|
||||||
|
serializedVersion: 12
|
||||||
|
m_Resolution: 2
|
||||||
|
m_BakeResolution: 40
|
||||||
|
m_AtlasSize: 1024
|
||||||
|
m_AO: 0
|
||||||
|
m_AOMaxDistance: 1
|
||||||
|
m_CompAOExponent: 1
|
||||||
|
m_CompAOExponentDirect: 0
|
||||||
|
m_ExtractAmbientOcclusion: 0
|
||||||
|
m_Padding: 2
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_LightmapsBakeMode: 1
|
||||||
|
m_TextureCompression: 1
|
||||||
|
m_FinalGather: 0
|
||||||
|
m_FinalGatherFiltering: 1
|
||||||
|
m_FinalGatherRayCount: 256
|
||||||
|
m_ReflectionCompression: 2
|
||||||
|
m_MixedBakeMode: 2
|
||||||
|
m_BakeBackend: 1
|
||||||
|
m_PVRSampling: 1
|
||||||
|
m_PVRDirectSampleCount: 32
|
||||||
|
m_PVRSampleCount: 512
|
||||||
|
m_PVRBounces: 2
|
||||||
|
m_PVREnvironmentSampleCount: 256
|
||||||
|
m_PVREnvironmentReferencePointCount: 2048
|
||||||
|
m_PVRFilteringMode: 1
|
||||||
|
m_PVRDenoiserTypeDirect: 1
|
||||||
|
m_PVRDenoiserTypeIndirect: 1
|
||||||
|
m_PVRDenoiserTypeAO: 1
|
||||||
|
m_PVRFilterTypeDirect: 0
|
||||||
|
m_PVRFilterTypeIndirect: 0
|
||||||
|
m_PVRFilterTypeAO: 0
|
||||||
|
m_PVREnvironmentMIS: 1
|
||||||
|
m_PVRCulling: 1
|
||||||
|
m_PVRFilteringGaussRadiusDirect: 1
|
||||||
|
m_PVRFilteringGaussRadiusIndirect: 5
|
||||||
|
m_PVRFilteringGaussRadiusAO: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||||
|
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||||
|
m_ExportTrainingData: 0
|
||||||
|
m_TrainingDataDestination: TrainingData
|
||||||
|
m_LightProbeSampleCountMultiplier: 4
|
||||||
|
m_LightingDataAsset: {fileID: 0}
|
||||||
|
m_LightingSettings: {fileID: 0}
|
||||||
|
--- !u!196 &4
|
||||||
|
NavMeshSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_BuildSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
agentTypeID: 0
|
||||||
|
agentRadius: 0.5
|
||||||
|
agentHeight: 2
|
||||||
|
agentSlope: 45
|
||||||
|
agentClimb: 0.4
|
||||||
|
ledgeDropHeight: 0
|
||||||
|
maxJumpAcrossDistance: 0
|
||||||
|
minRegionArea: 2
|
||||||
|
manualCellSize: 0
|
||||||
|
cellSize: 0.16666667
|
||||||
|
manualTileSize: 0
|
||||||
|
tileSize: 256
|
||||||
|
accuratePlacement: 0
|
||||||
|
maxJobWorkers: 0
|
||||||
|
preserveTilesOutsideBounds: 0
|
||||||
|
debug:
|
||||||
|
m_Flags: 0
|
||||||
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &516411417
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 516411421}
|
||||||
|
- component: {fileID: 516411420}
|
||||||
|
- component: {fileID: 516411419}
|
||||||
|
- component: {fileID: 516411418}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Main Camera
|
||||||
|
m_TagString: MainCamera
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &516411418
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 516411417}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 233344de094f11341bdb834d564708dc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 80
|
||||||
|
udpConnected: 0
|
||||||
|
userid: -1
|
||||||
|
room:
|
||||||
|
connected: 0
|
||||||
|
prefabs: []
|
||||||
|
sceneObjects: []
|
||||||
|
deletedSceneObjects: []
|
||||||
|
--- !u!81 &516411419
|
||||||
|
AudioListener:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 516411417}
|
||||||
|
m_Enabled: 1
|
||||||
|
--- !u!20 &516411420
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 516411417}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 1
|
||||||
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
m_projectionMatrixMode: 1
|
||||||
|
m_GateFitMode: 2
|
||||||
|
m_FOVAxisMode: 0
|
||||||
|
m_SensorSize: {x: 36, y: 24}
|
||||||
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_FocalLength: 50
|
||||||
|
m_NormalizedViewPortRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
near clip plane: 0.3
|
||||||
|
far clip plane: 1000
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 0
|
||||||
|
orthographic size: 5
|
||||||
|
m_Depth: -1
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 0}
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
m_TargetEye: 3
|
||||||
|
m_HDR: 1
|
||||||
|
m_AllowMSAA: 1
|
||||||
|
m_AllowDynamicResolution: 0
|
||||||
|
m_ForceIntoRT: 0
|
||||||
|
m_OcclusionCulling: 1
|
||||||
|
m_StereoConvergence: 10
|
||||||
|
m_StereoSeparation: 0.022
|
||||||
|
--- !u!4 &516411421
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 516411417}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &756322628
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 756322630}
|
||||||
|
- component: {fileID: 756322629}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Directional Light
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!108 &756322629
|
||||||
|
Light:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 756322628}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 10
|
||||||
|
m_Type: 1
|
||||||
|
m_Shape: 0
|
||||||
|
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||||
|
m_Intensity: 1
|
||||||
|
m_Range: 10
|
||||||
|
m_SpotAngle: 30
|
||||||
|
m_InnerSpotAngle: 21.80208
|
||||||
|
m_CookieSize: 10
|
||||||
|
m_Shadows:
|
||||||
|
m_Type: 2
|
||||||
|
m_Resolution: -1
|
||||||
|
m_CustomResolution: -1
|
||||||
|
m_Strength: 1
|
||||||
|
m_Bias: 0.05
|
||||||
|
m_NormalBias: 0.4
|
||||||
|
m_NearPlane: 0.2
|
||||||
|
m_CullingMatrixOverride:
|
||||||
|
e00: 1
|
||||||
|
e01: 0
|
||||||
|
e02: 0
|
||||||
|
e03: 0
|
||||||
|
e10: 0
|
||||||
|
e11: 1
|
||||||
|
e12: 0
|
||||||
|
e13: 0
|
||||||
|
e20: 0
|
||||||
|
e21: 0
|
||||||
|
e22: 1
|
||||||
|
e23: 0
|
||||||
|
e30: 0
|
||||||
|
e31: 0
|
||||||
|
e32: 0
|
||||||
|
e33: 1
|
||||||
|
m_UseCullingMatrixOverride: 0
|
||||||
|
m_Cookie: {fileID: 0}
|
||||||
|
m_DrawHalo: 0
|
||||||
|
m_Flare: {fileID: 0}
|
||||||
|
m_RenderMode: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_Lightmapping: 4
|
||||||
|
m_LightShadowCasterMode: 0
|
||||||
|
m_AreaSize: {x: 1, y: 1}
|
||||||
|
m_BounceIntensity: 1
|
||||||
|
m_ColorTemperature: 6570
|
||||||
|
m_UseColorTemperature: 0
|
||||||
|
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_UseBoundingSphereOverride: 0
|
||||||
|
m_UseViewFrustumForShadowCasterCull: 1
|
||||||
|
m_ShadowRadius: 0
|
||||||
|
m_ShadowAngle: 0
|
||||||
|
--- !u!4 &756322630
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 756322628}
|
||||||
|
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||||
|
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2e6e0ddeb76e51b46afc0f0a43386ff2
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.SceneManagement;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
namespace VelNet.Editor
|
||||||
|
{
|
||||||
|
public class EditorUtils : MonoBehaviour
|
||||||
|
{
|
||||||
|
[MenuItem("VelNet/Check For Duplicate NetworkIds", false, 10)]
|
||||||
|
private static void CheckDuplicateNetworkIds()
|
||||||
|
{
|
||||||
|
NetworkObject[] objs = FindObjectsOfType<NetworkObject>();
|
||||||
|
Dictionary<int, NetworkObject> ids = new Dictionary<int, NetworkObject>();
|
||||||
|
foreach (NetworkObject o in objs)
|
||||||
|
{
|
||||||
|
if (!o.isSceneObject) continue;
|
||||||
|
|
||||||
|
if (ids.ContainsKey(o.sceneNetworkId) || o.sceneNetworkId < 100)
|
||||||
|
{
|
||||||
|
if (ids.ContainsKey(o.sceneNetworkId))
|
||||||
|
{
|
||||||
|
Debug.Log($"Found duplicated id: {o.name} {ids[o.sceneNetworkId].name}", o);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log($"Found duplicated id: {o.name} {o.sceneNetworkId}", o);
|
||||||
|
}
|
||||||
|
|
||||||
|
o.sceneNetworkId = 100;
|
||||||
|
while (ids.ContainsKey(o.sceneNetworkId))
|
||||||
|
{
|
||||||
|
o.sceneNetworkId += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrefabUtility.RecordPrefabInstancePropertyModifications(o);
|
||||||
|
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
|
||||||
|
}
|
||||||
|
|
||||||
|
ids.Add(o.sceneNetworkId, o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8f2f5f489d44f614c96bcf8f493c787d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "VelNet.Editor",
|
||||||
|
"rootNamespace": "VelNet.Editor",
|
||||||
|
"references": [
|
||||||
|
"GUID:1e55e2c4387020247a1ae212bbcbd381"
|
||||||
|
],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": true,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ae0703a992a8fe347978b1cd2dd2d7a9
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -62,7 +62,7 @@ namespace VelNet
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
owner.SendMessage(this, index.ToString(), message, reliable);
|
VelNetPlayer.SendMessage(this, (byte)index, message, reliable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,15 +76,15 @@ namespace VelNet
|
||||||
|
|
||||||
// send the message and an identifier for which component it belongs to
|
// send the message and an identifier for which component it belongs to
|
||||||
int index = syncedComponents.IndexOf(component);
|
int index = syncedComponents.IndexOf(component);
|
||||||
owner.SendGroupMessage(this, group, index.ToString(), message, reliable);
|
VelNetPlayer.SendGroupMessage(this, group, (byte)index, message, reliable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReceiveBytes(string identifier, byte[] message)
|
public void ReceiveBytes(byte componentIdx, byte[] message)
|
||||||
{
|
{
|
||||||
// send the message to the right component
|
// send the message to the right component
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
syncedComponents[int.Parse(identifier)].ReceiveBytes(message);
|
syncedComponents[componentIdx].ReceiveBytes(message);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -128,6 +128,7 @@ namespace VelNet
|
||||||
foreach (NetworkComponent c in comps)
|
foreach (NetworkComponent c in comps)
|
||||||
{
|
{
|
||||||
c.networkObject = t;
|
c.networkObject = t;
|
||||||
|
PrefabUtility.RecordPrefabInstancePropertyModifications(c);
|
||||||
}
|
}
|
||||||
PrefabUtility.RecordPrefabInstancePropertyModifications(t);
|
PrefabUtility.RecordPrefabInstancePropertyModifications(t);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ namespace VelNet
|
||||||
{
|
{
|
||||||
public static class BinaryWriterExtensions
|
public static class BinaryWriterExtensions
|
||||||
{
|
{
|
||||||
|
#region Writers
|
||||||
|
|
||||||
public static void Write(this BinaryWriter writer, Vector3 v)
|
public static void Write(this BinaryWriter writer, Vector3 v)
|
||||||
{
|
{
|
||||||
writer.Write(v.x);
|
writer.Write(v.x);
|
||||||
|
|
@ -23,6 +25,18 @@ namespace VelNet
|
||||||
writer.Write(q.w);
|
writer.Write(q.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Write(this BinaryWriter writer, Color c)
|
||||||
|
{
|
||||||
|
writer.Write(c.r);
|
||||||
|
writer.Write(c.g);
|
||||||
|
writer.Write(c.b);
|
||||||
|
writer.Write(c.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Readers
|
||||||
|
|
||||||
public static Vector3 ReadVector3(this BinaryReader reader)
|
public static Vector3 ReadVector3(this BinaryReader reader)
|
||||||
{
|
{
|
||||||
return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
|
return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
|
||||||
|
|
@ -38,6 +52,35 @@ namespace VelNet
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Color ReadColor(this BinaryReader reader)
|
||||||
|
{
|
||||||
|
return new Color(
|
||||||
|
reader.ReadSingle(),
|
||||||
|
reader.ReadSingle(),
|
||||||
|
reader.ReadSingle(),
|
||||||
|
reader.ReadSingle()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public static bool BytesSame(byte[] b1, byte[] b2)
|
||||||
|
{
|
||||||
|
if (b1 == null && b2 != null) return false; // only one null
|
||||||
|
if (b1 != null && b2 == null) return false; // only one null
|
||||||
|
if (b1 == null) return true; // both null
|
||||||
|
|
||||||
|
// length doesn't match
|
||||||
|
if (b1.Length != b2.Length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if any bytes are different
|
||||||
|
return !b1.Where((t, i) => t != b2[i]).Any();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compresses the list of bools into bytes using a bitmask
|
/// Compresses the list of bools into bytes using a bitmask
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -88,6 +131,5 @@ namespace VelNet
|
||||||
{
|
{
|
||||||
return (b & (1 << index)) != 0;
|
return (b & (1 << index)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Collections;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
namespace VelNet
|
namespace VelNet
|
||||||
{
|
{
|
||||||
|
|
@ -9,6 +9,15 @@ namespace VelNet
|
||||||
[Tooltip("Send rate of this object. This caps out at the framerate of the game.")]
|
[Tooltip("Send rate of this object. This caps out at the framerate of the game.")]
|
||||||
public float serializationRateHz = 30;
|
public float serializationRateHz = 30;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If the data hasn't changed, only sends updates across the network at 1Hz
|
||||||
|
/// </summary>
|
||||||
|
public bool hybridOnChangeCompression = true;
|
||||||
|
|
||||||
|
private byte[] lastSentBytes;
|
||||||
|
private double lastSendTime;
|
||||||
|
private const double slowSendInterval = 2;
|
||||||
|
|
||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
StartCoroutine(SendMessageUpdate());
|
StartCoroutine(SendMessageUpdate());
|
||||||
|
|
@ -18,9 +27,31 @@ namespace VelNet
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (IsMine)
|
try
|
||||||
{
|
{
|
||||||
SendBytes(SendState());
|
if (IsMine && enabled)
|
||||||
|
{
|
||||||
|
byte[] newBytes = SendState();
|
||||||
|
if (hybridOnChangeCompression)
|
||||||
|
{
|
||||||
|
if (Time.timeAsDouble - lastSendTime > slowSendInterval || !BinaryWriterExtensions.BytesSame(lastSentBytes, newBytes))
|
||||||
|
{
|
||||||
|
SendBytes(newBytes);
|
||||||
|
lastSendTime = Time.timeAsDouble;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendBytes(newBytes);
|
||||||
|
lastSendTime = Time.timeAsDouble;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastSentBytes = newBytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return new WaitForSeconds(1f / serializationRateHz);
|
yield return new WaitForSeconds(1f / serializationRateHz);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
namespace VelNet
|
namespace VelNet
|
||||||
{
|
{
|
||||||
|
|
@ -11,6 +10,16 @@ namespace VelNet
|
||||||
[Tooltip("Send rate of this object. This caps out at the framerate of the game.")]
|
[Tooltip("Send rate of this object. This caps out at the framerate of the game.")]
|
||||||
public float serializationRateHz = 30;
|
public float serializationRateHz = 30;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If the data hasn't changed, only sends updates across the network at 1Hz
|
||||||
|
/// </summary>
|
||||||
|
public bool hybridOnChangeCompression = true;
|
||||||
|
|
||||||
|
private byte[] lastSentBytes;
|
||||||
|
private double lastSendTime;
|
||||||
|
private const double slowSendInterval = 2;
|
||||||
|
|
||||||
|
|
||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
StartCoroutine(SendMessageUpdate());
|
StartCoroutine(SendMessageUpdate());
|
||||||
|
|
@ -22,12 +31,28 @@ namespace VelNet
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsMine)
|
if (IsMine && enabled)
|
||||||
{
|
{
|
||||||
using MemoryStream mem = new MemoryStream();
|
using MemoryStream mem = new MemoryStream();
|
||||||
using BinaryWriter writer = new BinaryWriter(mem);
|
using BinaryWriter writer = new BinaryWriter(mem);
|
||||||
SendState(writer);
|
SendState(writer);
|
||||||
SendBytes(mem.ToArray());
|
|
||||||
|
byte[] newBytes = mem.ToArray();
|
||||||
|
if (hybridOnChangeCompression)
|
||||||
|
{
|
||||||
|
if (Time.timeAsDouble - lastSendTime > slowSendInterval || !BinaryWriterExtensions.BytesSame(lastSentBytes, newBytes))
|
||||||
|
{
|
||||||
|
SendBytes(newBytes);
|
||||||
|
lastSendTime = Time.timeAsDouble;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendBytes(newBytes);
|
||||||
|
lastSendTime = Time.timeAsDouble;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastSentBytes = newBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 03a4d4e1a7fd74c7ab2eccca4ce168db
|
guid: 233344de094f11341bdb834d564708dc
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace VelNet
|
namespace VelNet
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +42,12 @@ namespace VelNet
|
||||||
{
|
{
|
||||||
if (kvp.Value.owner == this && kvp.Value.prefabName != "")
|
if (kvp.Value.owner == this && kvp.Value.prefabName != "")
|
||||||
{
|
{
|
||||||
VelNetManager.SendTo(VelNetManager.MessageType.OTHERS, "7," + kvp.Value.networkId + "," + kvp.Value.prefabName);
|
using MemoryStream mem = new MemoryStream();
|
||||||
|
using BinaryWriter writer = new BinaryWriter(mem);
|
||||||
|
writer.Write((byte)VelNetManager.MessageType.Instantiate);
|
||||||
|
writer.Write(kvp.Value.networkId);
|
||||||
|
writer.Write(kvp.Value.prefabName);
|
||||||
|
VelNetManager.SendToRoom(mem.ToArray(), false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,77 +61,87 @@ namespace VelNet
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// These are generally things that come from the "owner" and should be enacted locally, where appropriate
|
/// These are generally things that come from the "owner" and should be enacted locally, where appropriate
|
||||||
|
///
|
||||||
|
/// Message encoding:
|
||||||
|
/// byte: message type
|
||||||
|
/// byte[]: message
|
||||||
|
///
|
||||||
|
/// The length of the byte[] for message is fixed according to the message type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void HandleMessage(VelNetManager.Message m)
|
public void HandleMessage(VelNetManager.DataMessage m)
|
||||||
{
|
{
|
||||||
//we need to parse the message
|
using MemoryStream mem = new MemoryStream(m.data);
|
||||||
|
using BinaryReader reader = new BinaryReader(mem);
|
||||||
|
|
||||||
//types of messages
|
//individual message parameters separated by comma
|
||||||
string[] messages = m.text.Split(';'); //messages are split by ;
|
VelNetManager.MessageType messageType = (VelNetManager.MessageType)reader.ReadByte();
|
||||||
foreach (string s in messages)
|
|
||||||
|
switch (messageType)
|
||||||
{
|
{
|
||||||
//individual message parameters separated by comma
|
case VelNetManager.MessageType.ObjectSync: // sync update for an object I may own
|
||||||
string[] sections = s.Split(',');
|
|
||||||
|
|
||||||
switch (sections[0])
|
|
||||||
{
|
{
|
||||||
case "5": // sync update for an object I may own
|
string objectKey = reader.ReadString();
|
||||||
|
byte componentIdx = reader.ReadByte();
|
||||||
|
int messageLength = reader.ReadInt32();
|
||||||
|
byte[] syncMessage = reader.ReadBytes(messageLength);
|
||||||
|
if (manager.objects.ContainsKey(objectKey))
|
||||||
{
|
{
|
||||||
string objectKey = sections[1];
|
if (manager.objects[objectKey].owner == this)
|
||||||
string identifier = sections[2];
|
|
||||||
string syncMessage = sections[3];
|
|
||||||
byte[] messageBytes = Convert.FromBase64String(syncMessage);
|
|
||||||
if (manager.objects.ContainsKey(objectKey))
|
|
||||||
{
|
{
|
||||||
if (manager.objects[objectKey].owner == this)
|
manager.objects[objectKey].ReceiveBytes(componentIdx, syncMessage);
|
||||||
{
|
|
||||||
manager.objects[objectKey].ReceiveBytes(identifier, messageBytes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "6": // I'm trying to take ownership of an object
|
|
||||||
{
|
|
||||||
string networkId = sections[1];
|
|
||||||
|
|
||||||
if (manager.objects.ContainsKey(networkId))
|
break;
|
||||||
{
|
|
||||||
manager.objects[networkId].owner = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "7": // I'm trying to instantiate an object
|
|
||||||
{
|
|
||||||
string networkId = sections[1];
|
|
||||||
string prefabName = sections[2];
|
|
||||||
if (manager.objects.ContainsKey(networkId))
|
|
||||||
{
|
|
||||||
break; //we already have this one, ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
VelNetManager.SomebodyInstantiatedNetworkObject(networkId, prefabName, this);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "8": // I'm trying to destroy a gameobject I own
|
|
||||||
{
|
|
||||||
string networkId = sections[1];
|
|
||||||
|
|
||||||
VelNetManager.NetworkDestroy(networkId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "9": //deleted scene objects
|
|
||||||
{
|
|
||||||
for (int k = 1; k < sections.Length; k++)
|
|
||||||
{
|
|
||||||
VelNetManager.NetworkDestroy(sections[k]);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
case VelNetManager.MessageType.TakeOwnership: // I'm trying to take ownership of an object
|
||||||
|
{
|
||||||
|
string networkId = reader.ReadString();
|
||||||
|
|
||||||
|
if (manager.objects.ContainsKey(networkId))
|
||||||
|
{
|
||||||
|
manager.objects[networkId].owner = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VelNetManager.MessageType.Instantiate: // I'm trying to instantiate an object
|
||||||
|
{
|
||||||
|
string networkId = reader.ReadString();
|
||||||
|
string prefabName = reader.ReadString();
|
||||||
|
if (manager.objects.ContainsKey(networkId))
|
||||||
|
{
|
||||||
|
break; //we already have this one, ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
VelNetManager.SomebodyInstantiatedNetworkObject(networkId, prefabName, this);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VelNetManager.MessageType.Destroy: // I'm trying to destroy a gameobject I own
|
||||||
|
{
|
||||||
|
string networkId = reader.ReadString();
|
||||||
|
|
||||||
|
VelNetManager.NetworkDestroy(networkId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VelNetManager.MessageType.DeleteSceneObjects: //deleted scene objects
|
||||||
|
{
|
||||||
|
int len = reader.ReadInt32();
|
||||||
|
for (int k = 1; k < len; k++)
|
||||||
|
{
|
||||||
|
VelNetManager.NetworkDestroy(reader.ReadString());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VelNetManager.MessageType.Custom: // custom packets
|
||||||
|
{
|
||||||
|
int len = reader.ReadInt32();
|
||||||
|
VelNetManager.CustomMessageReceived?.Invoke(reader.ReadBytes(len));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,19 +152,42 @@ namespace VelNet
|
||||||
//FindObjectsOfType<NetworkObject>();
|
//FindObjectsOfType<NetworkObject>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendGroupMessage(NetworkObject obj, string group, string identifier, byte[] data, bool reliable = true)
|
public static void SendGroupMessage(NetworkObject obj, string group, byte componentIdx, byte[] data, bool reliable = true)
|
||||||
{
|
{
|
||||||
VelNetManager.SendToGroup(group, "5," + obj.networkId + "," + identifier + "," + Convert.ToBase64String(data), reliable);
|
using MemoryStream mem = new MemoryStream();
|
||||||
|
using BinaryWriter writer = new BinaryWriter(mem);
|
||||||
|
writer.Write((byte)VelNetManager.MessageType.ObjectSync);
|
||||||
|
writer.Write(obj.networkId);
|
||||||
|
writer.Write(componentIdx);
|
||||||
|
writer.Write(data.Length);
|
||||||
|
writer.Write(data);
|
||||||
|
VelNetManager.SendToGroup(group, mem.ToArray(), reliable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(NetworkObject obj, string identifier, byte[] data, bool reliable = true)
|
public static void SendMessage(NetworkObject obj, byte componentIdx, byte[] data, bool reliable = true)
|
||||||
{
|
{
|
||||||
VelNetManager.SendTo(VelNetManager.MessageType.OTHERS, "5," + obj.networkId + "," + identifier + "," + Convert.ToBase64String(data), reliable);
|
using MemoryStream mem = new MemoryStream();
|
||||||
|
using BinaryWriter writer = new BinaryWriter(mem);
|
||||||
|
writer.Write((byte)VelNetManager.MessageType.ObjectSync);
|
||||||
|
writer.Write(obj.networkId);
|
||||||
|
writer.Write(componentIdx);
|
||||||
|
writer.Write(data.Length);
|
||||||
|
writer.Write(data);
|
||||||
|
VelNetManager.SendToRoom(mem.ToArray(), false, reliable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendSceneUpdate()
|
public void SendSceneUpdate()
|
||||||
{
|
{
|
||||||
VelNetManager.SendTo(VelNetManager.MessageType.OTHERS, "9," + string.Join(",", manager.deletedSceneObjects));
|
using MemoryStream mem = new MemoryStream();
|
||||||
|
using BinaryWriter writer = new BinaryWriter(mem);
|
||||||
|
writer.Write((byte)VelNetManager.MessageType.DeleteSceneObjects);
|
||||||
|
writer.Write(manager.deletedSceneObjects.Count);
|
||||||
|
foreach (string o in manager.deletedSceneObjects)
|
||||||
|
{
|
||||||
|
writer.Write(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
VelNetManager.SendToRoom(mem.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Use VelNetManager.NetworkDestroy() instead.")]
|
[Obsolete("Use VelNetManager.NetworkDestroy() instead.")]
|
||||||
|
|
@ -156,7 +197,12 @@ namespace VelNet
|
||||||
if (!manager.objects.ContainsKey(networkId) || manager.objects[networkId].owner != this || !isLocal) return;
|
if (!manager.objects.ContainsKey(networkId) || manager.objects[networkId].owner != this || !isLocal) return;
|
||||||
|
|
||||||
// send to all, which will make me delete as well
|
// send to all, which will make me delete as well
|
||||||
VelNetManager.SendTo(VelNetManager.MessageType.ALL_ORDERED, "8," + networkId);
|
|
||||||
|
using MemoryStream mem = new MemoryStream();
|
||||||
|
using BinaryWriter writer = new BinaryWriter(mem);
|
||||||
|
writer.Write((byte)VelNetManager.MessageType.Destroy);
|
||||||
|
writer.Write(networkId);
|
||||||
|
VelNetManager.SendToRoom(mem.ToArray(), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>True if successful, False if failed to transfer ownership</returns>
|
/// <returns>True if successful, False if failed to transfer ownership</returns>
|
||||||
|
|
@ -172,8 +218,13 @@ namespace VelNet
|
||||||
// immediately successful
|
// immediately successful
|
||||||
manager.objects[networkId].owner = this;
|
manager.objects[networkId].owner = this;
|
||||||
|
|
||||||
// must be ordered, so that ownership transfers are not confused. Also sent to all players, so that multiple simultaneous requests will result in the same outcome.
|
// must be ordered, so that ownership transfers are not confused.
|
||||||
VelNetManager.SendTo(VelNetManager.MessageType.ALL_ORDERED, "6," + networkId);
|
// Also sent to all players, so that multiple simultaneous requests will result in the same outcome.
|
||||||
|
using MemoryStream mem = new MemoryStream();
|
||||||
|
using BinaryWriter writer = new BinaryWriter(mem);
|
||||||
|
writer.Write((byte)VelNetManager.MessageType.TakeOwnership);
|
||||||
|
writer.Write(networkId);
|
||||||
|
VelNetManager.SendToRoom(mem.ToArray(), true, true, ordered: true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "edu.uga.engr.vel.velnet",
|
"name": "edu.uga.engr.vel.velnet",
|
||||||
"displayName": "VelNet",
|
"displayName": "VelNet",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"unity": "2019.1",
|
"unity": "2019.1",
|
||||||
"description": "A custom networking library for Unity.",
|
"description": "A custom networking library for Unity.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.collab-proxy": "1.15.7",
|
"com.unity.collab-proxy": "1.15.7",
|
||||||
"com.unity.ide.rider": "2.0.7",
|
"com.unity.ide.rider": "2.0.7",
|
||||||
"com.unity.ide.visualstudio": "2.0.12",
|
"com.unity.ide.visualstudio": "2.0.14",
|
||||||
"com.unity.ide.vscode": "1.2.4",
|
"com.unity.ide.vscode": "1.2.4",
|
||||||
"com.unity.test-framework": "1.1.30",
|
"com.unity.test-framework": "1.1.30",
|
||||||
"com.unity.textmeshpro": "3.0.6",
|
"com.unity.textmeshpro": "3.0.6",
|
||||||
"com.unity.timeline": "1.4.8",
|
"com.unity.timeline": "1.4.8",
|
||||||
"com.unity.ugui": "1.0.0",
|
"com.unity.ugui": "1.0.0",
|
||||||
"edu.uga.engr.vel.velnet.dissonance": "file:S:/git_repo/VelNetDissonanceIntegration",
|
"edu.uga.engr.vel.velnet.dissonance": "https://github.com/velaboratory/VelNetDissonanceIntegration.git",
|
||||||
"com.unity.modules.ai": "1.0.0",
|
"com.unity.modules.ai": "1.0.0",
|
||||||
"com.unity.modules.androidjni": "1.0.0",
|
"com.unity.modules.androidjni": "1.0.0",
|
||||||
"com.unity.modules.animation": "1.0.0",
|
"com.unity.modules.animation": "1.0.0",
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.ide.visualstudio": {
|
"com.unity.ide.visualstudio": {
|
||||||
"version": "2.0.12",
|
"version": "2.0.14",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
@ -106,12 +106,13 @@
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
},
|
},
|
||||||
"edu.uga.engr.vel.velnet.dissonance": {
|
"edu.uga.engr.vel.velnet.dissonance": {
|
||||||
"version": "file:S:/git_repo/VelNetDissonanceIntegration",
|
"version": "https://github.com/velaboratory/VelNetDissonanceIntegration.git",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "local",
|
"source": "git",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"edu.uga.engr.vel.velnet": "1.0.4"
|
"edu.uga.engr.vel.velnet": "1.0.4"
|
||||||
}
|
},
|
||||||
|
"hash": "2767cf12e6f1b5c568c44cd6f1753866ae2e6fca"
|
||||||
},
|
},
|
||||||
"com.unity.modules.ai": {
|
"com.unity.modules.ai": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue