Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ public abstract class NetworkObject
/// </summary>
protected Dictionary<byte, string> inverseRpcLookup = new Dictionary<byte, string>();

/// <summary>
/// Get the friendly name from the Method ID - useful for Debug output
/// </summary>
public string RPCName(byte methodId) => inverseRpcLookup[methodId];

/// <summary>
/// Is <c>true</c> if this object has been fully setup on the network
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// Get's the magnitude (pythagorean theorem) of this vector (the length
Expand Down Expand Up @@ -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);
}

/// <summary>
/// Get's the dot product of this vector and another
/// </summary>
Expand Down