diff --git a/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/NetworkManager.cs b/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/NetworkManager.cs index b6b228e5..c322d099 100644 --- a/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/NetworkManager.cs +++ b/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/NetworkManager.cs @@ -465,6 +465,9 @@ protected virtual void ReadBinary(NetworkingPlayer player, Binary frame, NetWork if (scenesToLoad.Length == 0) return; + if (!automaticScenes) + return; + SceneManager.LoadScene(scenesToLoad[0], LoadSceneMode.Single); for (int i = 1; i < scenesToLoad.Length; i++) @@ -513,6 +516,9 @@ protected virtual void ReadBinary(NetworkingPlayer player, Binary frame, NetWork MainThreadManager.Run(() => { + if (!automaticScenes) + return; + // Load the scene that the server loaded in the same LoadSceneMode if (mode == LoadSceneMode.Additive) SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive); diff --git a/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Forge/Networking/Objects/NetworkObject.cs b/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Forge/Networking/Objects/NetworkObject.cs index 8f07a240..c4f821ab 100644 --- a/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Forge/Networking/Objects/NetworkObject.cs +++ b/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Forge/Networking/Objects/NetworkObject.cs @@ -171,6 +171,11 @@ public abstract class NetworkObject /// protected Dictionary inverseRpcLookup = new Dictionary(); + /// + /// Get the friendly name from the Method ID - useful for Debug output + /// + public string RPCName(byte methodId) => inverseRpcLookup[methodId]; + /// /// Is true if this object has been fully setup on the network /// diff --git a/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Vector.cs b/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Vector.cs index 9883f7b0..c5af5c7d 100644 --- a/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Vector.cs +++ b/Forge Networking Remastered Unity/Assets/Bearded Man Studios Inc/Scripts/Networking/Vector.cs @@ -2,13 +2,14 @@ namespace BeardedManStudios { + [System.Serializable] public struct Vector { - public float x { get; set; } + public float x; - public float y { get; set; } + public float y; - public float z { get; set; } + public float z; /// /// Get's the magnitude (pythagorean theorem) of this vector (the length @@ -54,6 +55,33 @@ public Vector(float x, float y, float z) : this() this.z = z; } + public static implicit operator UnityEngine.Vector3(Vector x) + { + return new UnityEngine.Vector3(x.x, x.y, x.z); + } + + public static implicit operator Vector(UnityEngine.Vector3 x) + { + return new Vector(x.x, x.y, x.z); + } + + public static bool operator ==(Vector lhs, Vector rhs) + { + // If both null, true + if(ReferenceEquals(lhs, rhs)) return true; + + // Else, any nulls are false + if(ReferenceEquals(lhs, null) || ReferenceEquals(rhs, null)) return false; + + // Equals handles case of null on right side. + return lhs.Equals(rhs); + } + + public static bool operator !=(Vector lhs, Vector rhs) + { + return !(lhs == rhs); + } + /// /// Get's the dot product of this vector and another ///