mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
cleanup
This commit is contained in:
parent
f61dd290e3
commit
cf29a06bca
@ -20,17 +20,14 @@ public override void SetUp()
|
||||
public IEnumerator LocalPlayerIsSetToNullAfterDestroy()
|
||||
{
|
||||
// need spawned local player
|
||||
CreateNetworkedAndSpawnPlayer(out GameObject go, out NetworkIdentity identity, NetworkServer.localConnection);
|
||||
CreateNetworkedAndSpawnPlayer(out GameObject go, out _, NetworkServer.localConnection);
|
||||
|
||||
// need to have localPlayer set for this test
|
||||
Assert.That(NetworkClient.localPlayer, !Is.Null);
|
||||
|
||||
// destroy, wait one frame, localPlayer should be cleared
|
||||
GameObject.Destroy(go);
|
||||
|
||||
// wait a frame for destroy to happen
|
||||
yield return null;
|
||||
|
||||
// use "is null" here to avoid unity == check
|
||||
Assert.IsTrue(NetworkClient.localPlayer is null, "local player should be set to c# null");
|
||||
}
|
||||
|
||||
@ -46,11 +43,9 @@ public IEnumerator DestroyingOtherObjectDoesntEffectLocalPlayer()
|
||||
// need to have localPlayer set for this test
|
||||
Assert.That(NetworkClient.localPlayer, !Is.Null);
|
||||
|
||||
// destroy, wait one frame, localPlayer should remain
|
||||
GameObject.Destroy(notPlayer);
|
||||
|
||||
// wait a frame for destroy to happen
|
||||
yield return null;
|
||||
|
||||
Assert.IsTrue(NetworkClient.localPlayer != null, "local player should not be cleared");
|
||||
Assert.IsTrue(NetworkClient.localPlayer == player, "local player should still be equal to player");
|
||||
}
|
||||
@ -59,20 +54,17 @@ public IEnumerator DestroyingOtherObjectDoesntEffectLocalPlayer()
|
||||
public IEnumerator LocalPlayerIsSetToNullAfterDestroyMessage()
|
||||
{
|
||||
// need spawned local player
|
||||
CreateNetworkedAndSpawnPlayer(out GameObject go, out NetworkIdentity identity, NetworkServer.localConnection);
|
||||
CreateNetworkedAndSpawnPlayer(out _, out NetworkIdentity identity, NetworkServer.localConnection);
|
||||
|
||||
// need to have localPlayer set for this test
|
||||
Assert.That(NetworkClient.localPlayer, !Is.Null);
|
||||
|
||||
// OnObjectDestroy, wait one frame, localPlayer should be cleared
|
||||
NetworkClient.OnObjectDestroy(new ObjectDestroyMessage
|
||||
{
|
||||
netId = identity.netId
|
||||
});
|
||||
|
||||
// wait a frame for destroy to happen
|
||||
yield return null;
|
||||
|
||||
// use "is null" here to avoid unity == check
|
||||
Assert.IsTrue(NetworkClient.localPlayer is null, "local player should be set to c# null");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user