move all the things

This commit is contained in:
vis2k 2021-03-07 19:57:46 +08:00
parent 0bc2a5573f
commit 92c9522388
15 changed files with 79 additions and 79 deletions

View File

@ -127,7 +127,7 @@ void CheckSpeed()
{
animatorSpeed = newSpeed;
}
else if (ClientScene.readyConnection != null)
else if (NetworkClient.readyConnection != null)
{
CmdSetAnimatorSpeed(newSpeed);
}
@ -215,7 +215,7 @@ void SendAnimationMessage(int stateHash, float normalizedTime, int layerId, floa
{
RpcOnAnimationClientMessage(stateHash, normalizedTime, layerId, weight, parameters);
}
else if (ClientScene.readyConnection != null)
else if (NetworkClient.readyConnection != null)
{
CmdOnAnimationServerMessage(stateHash, normalizedTime, layerId, weight, parameters);
}
@ -227,7 +227,7 @@ void SendAnimationParametersMessage(byte[] parameters)
{
RpcOnAnimationParametersClientMessage(parameters);
}
else if (ClientScene.readyConnection != null)
else if (NetworkClient.readyConnection != null)
{
CmdOnAnimationParametersServerMessage(parameters);
}
@ -455,7 +455,7 @@ public void SetTrigger(int hash)
return;
}
if (ClientScene.readyConnection != null)
if (NetworkClient.readyConnection != null)
CmdOnAnimationTriggerServerMessage(hash);
// call on client right away
@ -504,7 +504,7 @@ public void ResetTrigger(int hash)
return;
}
if (ClientScene.readyConnection != null)
if (NetworkClient.readyConnection != null)
CmdOnAnimationResetTriggerServerMessage(hash);
// call on client right away

View File

@ -303,7 +303,7 @@ public override void OnServerDisconnect(NetworkConnection conn)
public int clientIndex;
/// <summary>
/// Called on the server when a client adds a new player with ClientScene.AddPlayer.
/// Called on the server when a client adds a new player with NetworkClient.AddPlayer.
/// <para>The default implementation for this function creates a new player object from the playerPrefab.</para>
/// </summary>
/// <param name="conn">Connection from client.</param>

View File

@ -23,7 +23,7 @@ public class BasicNetManager : NetworkManager
public RectTransform playersPanel;
/// <summary>
/// Called on the server when a client adds a new player with ClientScene.AddPlayer.
/// Called on the server when a client adds a new player with NetworkClient.AddPlayer.
/// <para>The default implementation for this function creates a new player object from the playerPrefab.</para>
/// </summary>
/// <param name="conn">Connection from client.</param>

View File

@ -27,7 +27,7 @@ public class MultiSceneNetManager : NetworkManager
int clientIndex;
/// <summary>
/// Called on the server when a client adds a new player with ClientScene.AddPlayer.
/// Called on the server when a client adds a new player with NetworkClient.AddPlayer.
/// <para>The default implementation for this function creates a new player object from the playerPrefab.</para>
/// </summary>
/// <param name="conn">Connection from client.</param>

View File

@ -65,7 +65,7 @@ public struct SpawnMessage : NetworkMessage
/// </summary>
public uint netId;
/// <summary>
/// Is the spawning object the local player. Sets ClientScene.localPlayer
/// Is the spawning object the local player. Sets NetworkClient.localPlayer
/// </summary>
public bool isLocalPlayer;
/// <summary>

View File

@ -186,7 +186,7 @@ protected void SendCommandInternal(Type invokeClass, string cmdName, NetworkWrit
return;
}
if (ClientScene.readyConnection == null)
if (NetworkClient.readyConnection == null)
{
Debug.LogError("Send command attempted with no client running [client=" + connectionToServer + "].");
return;
@ -203,7 +203,7 @@ protected void SendCommandInternal(Type invokeClass, string cmdName, NetworkWrit
payload = writer.ToArraySegment()
};
ClientScene.readyConnection.Send(message, channelId);
NetworkClient.readyConnection.Send(message, channelId);
}
#endregion

View File

@ -643,7 +643,7 @@ public static void RegisterPrefab(GameObject prefab, SpawnHandlerDelegate spawnH
unspawnHandlers[assetId] = unspawnHandler;
}
/// <summary>Removes a registered spawn prefab that was setup with ClientScene.RegisterPrefab.</summary>
/// <summary>Removes a registered spawn prefab that was setup with NetworkClient.RegisterPrefab.</summary>
public static void UnregisterPrefab(GameObject prefab)
{
if (prefab == null)
@ -728,7 +728,7 @@ public static void RegisterSpawnHandler(Guid assetId, SpawnHandlerDelegate spawn
unspawnHandlers[assetId] = unspawnHandler;
}
/// <summary> Removes a registered spawn handler function that was registered with ClientScene.RegisterHandler().</summary>
/// <summary> Removes a registered spawn handler function that was registered with NetworkClient.RegisterHandler().</summary>
public static void UnregisterSpawnHandler(Guid assetId)
{
spawnHandlers.Remove(assetId);
@ -767,7 +767,7 @@ public static bool Ready(NetworkConnection conn)
return false;
}
// Debug.Log("ClientScene.Ready() called with connection [" + conn + "]");
// Debug.Log("NetworkClient.Ready() called with connection [" + conn + "]");
if (conn != null)
{
@ -798,7 +798,7 @@ internal static void HandleClientDisconnect(NetworkConnection conn)
// called from message handler for Owner message
internal static void InternalAddPlayer(NetworkIdentity identity)
{
//Debug.Log("ClientScene.InternalAddPlayer");
//Debug.Log("NetworkClient.InternalAddPlayer");
// NOTE: It can be "normal" when changing scenes for the player to be destroyed and recreated.
// But, the player structures are not cleaned up, we'll just replace the old player
@ -819,7 +819,7 @@ internal static void InternalAddPlayer(NetworkIdentity identity)
// object is destroyed.
internal static void ClearLocalPlayer()
{
//Debug.Log("ClientScene.ClearLocalPlayer");
//Debug.Log("NetworkClient.ClearLocalPlayer");
localPlayer = null;
}
@ -841,11 +841,11 @@ public static bool AddPlayer(NetworkConnection readyConn)
if (readyConnection.identity != null)
{
Debug.LogError("ClientScene.AddPlayer: a PlayerController was already added. Did you call AddPlayer twice?");
Debug.LogError("NetworkClient.AddPlayer: a PlayerController was already added. Did you call AddPlayer twice?");
return false;
}
// Debug.Log("ClientScene.AddPlayer() called with connection [" + readyConnection + "]");
// Debug.Log("NetworkClient.AddPlayer() called with connection [" + readyConnection + "]");
readyConnection.Send(new AddPlayerMessage());
return true;
}
@ -1059,7 +1059,7 @@ static void ClearNullFromSpawned()
// host mode callbacks /////////////////////////////////////////////////
static void OnHostClientObjectDestroy(ObjectDestroyMessage msg)
{
// Debug.Log("ClientScene.OnLocalObjectObjDestroy netId:" + msg.netId);
// Debug.Log("NetworkClient.OnLocalObjectObjDestroy netId:" + msg.netId);
NetworkIdentity.spawned.Remove(msg.netId);
}
@ -1092,7 +1092,7 @@ internal static void OnHostClientSpawn(SpawnMessage msg)
// client-only mode callbacks //////////////////////////////////////////
static void OnUpdateVarsMessage(UpdateVarsMessage msg)
{
// Debug.Log("ClientScene.OnUpdateVarsMessage " + msg.netId);
// Debug.Log("NetworkClient.OnUpdateVarsMessage " + msg.netId);
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null)
{
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(msg.payload))
@ -1103,7 +1103,7 @@ static void OnUpdateVarsMessage(UpdateVarsMessage msg)
static void OnRPCMessage(RpcMessage msg)
{
// Debug.Log("ClientScene.OnRPCMessage hash:" + msg.functionHash + " netId:" + msg.netId);
// Debug.Log("NetworkClient.OnRPCMessage hash:" + msg.functionHash + " netId:" + msg.netId);
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity identity))
{
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(msg.payload))
@ -1126,20 +1126,20 @@ internal static void OnSpawn(SpawnMessage msg)
internal static void CheckForLocalPlayer(NetworkIdentity identity)
{
if (identity == ClientScene.localPlayer)
if (identity == localPlayer)
{
// Set isLocalPlayer to true on this NetworkIdentity and trigger
// OnStartLocalPlayer in all scripts on the same GO
identity.connectionToServer = ClientScene.readyConnection;
identity.connectionToServer = readyConnection;
identity.OnStartLocalPlayer();
// Debug.Log("ClientScene.OnOwnerMessage - player=" + identity.name);
// Debug.Log("NetworkClient.OnOwnerMessage - player=" + identity.name);
}
}
// destroy /////////////////////////////////////////////////////////////
static void DestroyObject(uint netId)
{
// Debug.Log("ClientScene.OnObjDestroy netId:" + netId);
// Debug.Log("NetworkClient.OnObjDestroy netId:" + netId);
if (NetworkIdentity.spawned.TryGetValue(netId, out NetworkIdentity localObject) && localObject != null)
{
localObject.OnStopClient();
@ -1257,8 +1257,8 @@ public static void Shutdown()
Debug.Log("Shutting down client.");
ClearSpawners();
spawnableObjects.Clear();
ClientScene.readyConnection = null;
ClientScene.ready = false;
readyConnection = null;
ready = false;
isSpawnFinished = false;
DestroyAllClientObjects();
connectState = ConnectState.None;

View File

@ -45,8 +45,8 @@ public abstract class NetworkConnection
public object authenticationData;
/// <summary>
/// Flag that tells if the connection has been marked as "ready" by a client calling ClientScene.Ready().
/// <para>This property is read-only. It is set by the system on the client when ClientScene.Ready() is called, and set by the system on the server when a ready message is received from a client.</para>
/// Flag that tells if the connection has been marked as "ready" by a client calling NetworkClient.Ready().
/// <para>This property is read-only. It is set by the system on the client when NetworkClient.Ready() is called, and set by the system on the server when a ready message is received from a client.</para>
/// <para>A client that is ready is sent spawned objects by the server and updates to the state of spawned objects. A client that is not ready is not sent spawned objects.</para>
/// </summary>
public bool isReady;

View File

@ -151,7 +151,7 @@ public sealed class NetworkIdentity : MonoBehaviour
// for saving, etc. since isLocalPlayer may have been reset before
// OnDestroy was called.
//
// we also DO NOT make it dependent on ClientScene.localPlayer or similar.
// we also DO NOT make it dependent on NetworkClient.localPlayer or similar.
// we set it, then never change it. that's the user's expectation too.
//
// => fixes https://github.com/vis2k/Mirror/issues/2615
@ -706,8 +706,8 @@ internal void OnStartServer()
// set isLocalPlayer earlier, in case OnStartLocalplayer is called
// AFTER OnStartClient, in which case it would still be falsse here.
// many projects will check isLocalPlayer in OnStartClient though.
// TODO ideally set isLocalPlayer when ClientScene.localPlayer is set?
if (ClientScene.localPlayer == this)
// TODO ideally set isLocalPlayer when NetworkClient.localPlayer is set?
if (NetworkClient.localPlayer == this)
{
isLocalPlayer = true;
}
@ -791,8 +791,8 @@ internal void OnStartClient()
// set isLocalPlayer earlier, in case OnStartLocalplayer is called
// AFTER OnStartClient, in which case it would still be falsse here.
// many projects will check isLocalPlayer in OnStartClient though.
// TODO ideally set isLocalPlayer when ClientScene.localPlayer is set?
if (ClientScene.localPlayer == this)
// TODO ideally set isLocalPlayer when NetworkClient.localPlayer is set?
if (NetworkClient.localPlayer == this)
{
isLocalPlayer = true;
}

View File

@ -169,7 +169,7 @@ public class NetworkManager : MonoBehaviour
/// <summary>
/// List of prefabs that will be registered with the spawning system.
/// <para>For each of these prefabs, ClientScene.RegisterPrefab() will be automatically invoked.</para>
/// <para>For each of these prefabs, NetworkClient.RegisterPrefab() will be automatically invoked.</para>
/// </summary>
[FormerlySerializedAs("m_SpawnPrefabs"), HideInInspector]
public List<GameObject> spawnPrefabs = new List<GameObject>();
@ -967,7 +967,7 @@ internal void ClientChangeScene(string newSceneName, SceneOperation sceneOperati
// NetworkScenePostProcess disables all scene objects on load, and
// * NetworkServer.SpawnObjects enables them again on the server when
// calling OnStartServer
// * ClientScene.PrepareToSpawnSceneObjects enables them again on the
// * NetworkClient.PrepareToSpawnSceneObjects enables them again on the
// client after the server sends ObjectSpawnStartedMessage to client
// in SpawnObserversForConnection. this is only called when the
// client joins, so we need to rebuild scene objects manually again
@ -984,7 +984,7 @@ void OnSceneLoaded(Scene scene, LoadSceneMode mode)
}
if (NetworkClient.active)
{
ClientScene.PrepareToSpawnSceneObjects();
NetworkClient.PrepareToSpawnSceneObjects();
// Debug.Log("Rebuild Client spawnableObjects after additive scene load: " + scene.name);
}
}
@ -1351,7 +1351,7 @@ public virtual void OnServerReady(NetworkConnection conn)
}
/// <summary>
/// Called on the server when a client adds a new player with ClientScene.AddPlayer.
/// Called on the server when a client adds a new player with NetworkClient.AddPlayer.
/// <para>The default implementation for this function creates a new player object from the playerPrefab.</para>
/// </summary>
/// <param name="conn">Connection from client.</param>
@ -1403,10 +1403,10 @@ public virtual void OnClientConnect(NetworkConnection conn)
if (!clientLoadedScene)
{
// Ready/AddPlayer is usually triggered by a scene load completing. if no scene was loaded, then Ready/AddPlayer it here instead.
if (!ClientScene.ready) ClientScene.Ready(conn);
if (!NetworkClient.ready) NetworkClient.Ready(conn);
if (autoCreatePlayer)
{
ClientScene.AddPlayer(conn);
NetworkClient.AddPlayer(conn);
}
}
}
@ -1453,13 +1453,13 @@ public virtual void OnClientChangeScene(string newSceneName, SceneOperation scen
public virtual void OnClientSceneChanged(NetworkConnection conn)
{
// always become ready.
if (!ClientScene.ready) ClientScene.Ready(conn);
if (!NetworkClient.ready) NetworkClient.Ready(conn);
// Only call AddPlayer for normal scene changes, not additive load/unload
if (clientSceneOperation == SceneOperation.Normal && autoCreatePlayer && ClientScene.localPlayer == null)
if (clientSceneOperation == SceneOperation.Normal && autoCreatePlayer && NetworkClient.localPlayer == null)
{
// add player if existing one is null
ClientScene.AddPlayer(conn);
NetworkClient.AddPlayer(conn);
}
}

View File

@ -56,15 +56,15 @@ void OnGUI()
}
// client ready
if (NetworkClient.isConnected && !ClientScene.ready)
if (NetworkClient.isConnected && !NetworkClient.ready)
{
if (GUILayout.Button("Client Ready"))
{
ClientScene.Ready(NetworkClient.connection);
NetworkClient.Ready(NetworkClient.connection);
if (ClientScene.localPlayer == null)
if (NetworkClient.localPlayer == null)
{
ClientScene.AddPlayer(NetworkClient.connection);
NetworkClient.AddPlayer(NetworkClient.connection);
}
}
}

View File

@ -125,7 +125,7 @@ public static void Listen(int maxConns)
RegisterMessageHandlers();
}
// Note: ClientScene.DestroyAllClientObjects does the same on client.
// Note: NetworkClient.DestroyAllClientObjects does the same on client.
static void CleanupNetworkIdentities()
{
foreach (NetworkIdentity identity in NetworkIdentity.spawned.Values)

View File

@ -73,22 +73,22 @@ protected void CallRegisterPrefab(GameObject prefab, RegisterPrefabOverload over
switch (overload)
{
case RegisterPrefabOverload.Prefab:
ClientScene.RegisterPrefab(prefab);
NetworkClient.RegisterPrefab(prefab);
break;
case RegisterPrefabOverload.Prefab_NewAssetId:
ClientScene.RegisterPrefab(prefab, anotherGuid);
NetworkClient.RegisterPrefab(prefab, anotherGuid);
break;
case RegisterPrefabOverload.Prefab_SpawnDelegate:
ClientScene.RegisterPrefab(prefab, spawnHandler, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, spawnHandler, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, anotherGuid, spawnHandler, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, anotherGuid, spawnHandler, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnHandlerDelegate:
ClientScene.RegisterPrefab(prefab, spawnHandlerDelegate, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, spawnHandlerDelegate, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnHandlerDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, anotherGuid, spawnHandlerDelegate, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, anotherGuid, spawnHandlerDelegate, unspawnHandler);
break;
default:
@ -106,13 +106,13 @@ protected void CallRegisterPrefab(GameObject prefab, RegisterPrefabOverload over
switch (overload)
{
case RegisterPrefabOverload.Prefab_NewAssetId:
ClientScene.RegisterPrefab(prefab, guid);
NetworkClient.RegisterPrefab(prefab, guid);
break;
case RegisterPrefabOverload.Prefab_SpawnDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, guid, spawnHandler, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, guid, spawnHandler, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnHandlerDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, guid, spawnHandlerDelegate, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, guid, spawnHandlerDelegate, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab:
@ -133,10 +133,10 @@ protected void CallRegisterPrefab(GameObject prefab, RegisterPrefabOverload over
switch (overload)
{
case RegisterPrefabOverload.Prefab_SpawnDelegate:
ClientScene.RegisterPrefab(prefab, spawnHandler, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, spawnHandler, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, anotherGuid, spawnHandler, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, anotherGuid, spawnHandler, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab:
@ -158,10 +158,10 @@ protected void CallRegisterPrefab(GameObject prefab, RegisterPrefabOverload over
switch (overload)
{
case RegisterPrefabOverload.Prefab_SpawnHandlerDelegate:
ClientScene.RegisterPrefab(prefab, spawnHandlerDelegate, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, spawnHandlerDelegate, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnHandlerDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, anotherGuid, spawnHandlerDelegate, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, anotherGuid, spawnHandlerDelegate, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab:
@ -185,16 +185,16 @@ protected void CallRegisterPrefab(GameObject prefab, RegisterPrefabOverload over
{
case RegisterPrefabOverload.Prefab_SpawnDelegate:
ClientScene.RegisterPrefab(prefab, spawnHandler, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, spawnHandler, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, anotherGuid, spawnHandler, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, anotherGuid, spawnHandler, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnHandlerDelegate:
ClientScene.RegisterPrefab(prefab, spawnHandlerDelegate, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, spawnHandlerDelegate, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab_SpawnHandlerDelegate_NewAssetId:
ClientScene.RegisterPrefab(prefab, anotherGuid, spawnHandlerDelegate, unspawnHandler);
NetworkClient.RegisterPrefab(prefab, anotherGuid, spawnHandlerDelegate, unspawnHandler);
break;
case RegisterPrefabOverload.Prefab:

View File

@ -93,7 +93,7 @@ public IEnumerator DestroysAllNetworkPrefabsInScene()
listener2.onDestroyCalled += () => destroyCalled2++;
listener3.onDestroyCalled += () => destroyCalled3++;
ClientScene.DestroyAllClientObjects();
NetworkClient.DestroyAllClientObjects();
// wait for frame to make sure unity events are called
yield return null;
@ -127,7 +127,7 @@ public IEnumerator DisablesAllNetworkSceneObjectsInScene()
listener2.onDestroyCalled += () => destroyCalled2++;
listener3.onDestroyCalled += () => destroyCalled3++;
ClientScene.DestroyAllClientObjects();
NetworkClient.DestroyAllClientObjects();
// wait for frame to make sure unity events are called
yield return null;
@ -172,7 +172,7 @@ public void CallsUnspawnHandlerInsteadOfDestroy()
listener2.onDisableCalled += () => disableCalled2++;
listener3.onDisableCalled += () => disableCalled3++;
ClientScene.DestroyAllClientObjects();
NetworkClient.DestroyAllClientObjects();
Assert.That(unspawnCalled1, Is.EqualTo(1));
Assert.That(unspawnCalled2, Is.EqualTo(1));
@ -191,7 +191,7 @@ public void ClearsSpawnedList()
TestListenerBehaviour listener2 = CreateAndAddObject(30002, 0);
TestListenerBehaviour listener3 = CreateAndAddObject(30003, 0);
ClientScene.DestroyAllClientObjects();
NetworkClient.DestroyAllClientObjects();
Assert.That(spawned, Is.Empty);
}
@ -207,7 +207,7 @@ public void CatchesAndLogsExeptionWhenSpawnedListIsChanged()
LogAssert.Expect(LogType.Exception, new Regex("InvalidOperationException"));
LogAssert.Expect(LogType.Error, "Could not DestroyAllClientObjects because spawned list was modified during loop, make sure you are not modifying NetworkIdentity.spawned by calling NetworkServer.Destroy or NetworkServer.Spawn in OnDestroy or OnDisable.");
ClientScene.DestroyAllClientObjects();
NetworkClient.DestroyAllClientObjects();
}
}
}

View File

@ -11,9 +11,9 @@ public class ClientSceneTests_LocalPlayer : ClientSceneTestsBase
[SetUp]
public void Setup()
{
Debug.Assert(ClientScene.localPlayer == null, "LocalPlayer should be null before this test");
Debug.Assert(NetworkClient.localPlayer == null, "LocalPlayer should be null before this test");
PropertyInfo readyConnProperty = typeof(ClientScene).GetProperty(nameof(ClientScene.readyConnection));
PropertyInfo readyConnProperty = typeof(ClientScene).GetProperty(nameof(NetworkClient.readyConnection));
readyConnProperty.SetValue(null, new FakeNetworkConnection());
}
@ -37,7 +37,7 @@ NetworkIdentity SpawnObject(bool localPlayer)
if (localPlayer)
{
Assert.That(ClientScene.localPlayer, Is.EqualTo(identity));
Assert.That(NetworkClient.localPlayer, Is.EqualTo(identity));
}
return identity;
@ -54,7 +54,7 @@ public IEnumerator LocalPlayerIsSetToNullAfterDestroy()
yield return null;
// use "is null" here to avoid unity == check
Assert.IsTrue(ClientScene.localPlayer is null, "local player should be set to c# null");
Assert.IsTrue(NetworkClient.localPlayer is null, "local player should be set to c# null");
}
[UnityTest]
@ -68,8 +68,8 @@ public IEnumerator DestroyingOtherObjectDoesntEffectLocalPlayer()
// wait a frame for destroy to happen
yield return null;
Assert.IsTrue(ClientScene.localPlayer != null, "local player should not be cleared");
Assert.IsTrue(ClientScene.localPlayer == player, "local player should still be equal to player");
Assert.IsTrue(NetworkClient.localPlayer != null, "local player should not be cleared");
Assert.IsTrue(NetworkClient.localPlayer == player, "local player should still be equal to player");
}
[UnityTest]
@ -86,7 +86,7 @@ public IEnumerator LocalPlayerIsSetToNullAfterDestroyMessage()
yield return null;
// use "is null" here to avoid unity == check
Assert.IsTrue(ClientScene.localPlayer is null, "local player should be set to c# null");
Assert.IsTrue(NetworkClient.localPlayer is null, "local player should be set to c# null");
}
}
public class ClientSceneTest_LocalPlayer_asHost : HostSetup
@ -117,7 +117,7 @@ public IEnumerator LocalPlayerIsSetToNullAfterNetworkDestroy()
yield return null;
// use "is null" here to avoid unity == check
Assert.IsTrue(ClientScene.localPlayer is null, "local player should be set to c# null");
Assert.IsTrue(NetworkClient.localPlayer is null, "local player should be set to c# null");
}
[UnityTest]
@ -146,7 +146,7 @@ public IEnumerator LocalPlayerIsSetToNullAfterNetworkUnspawn()
yield return null;
// use "is null" here to avoid unity == check
Assert.IsTrue(ClientScene.localPlayer is null, "local player should be set to c# null");
Assert.IsTrue(NetworkClient.localPlayer is null, "local player should be set to c# null");
}
}
}