mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
SyncVarTest: reuse CreateNetworked
This commit is contained in:
parent
f846b311f3
commit
8961eb2ec6
@ -41,9 +41,7 @@ public class SyncVarTest : SyncVarTestBase
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestSettingStruct()
|
public void TestSettingStruct()
|
||||||
{
|
{
|
||||||
GameObject gameObject = new GameObject();
|
CreateNetworked(out GameObject gameObject, out NetworkIdentity identity, out MockPlayer player);
|
||||||
|
|
||||||
MockPlayer player = gameObject.AddComponent<MockPlayer>();
|
|
||||||
|
|
||||||
// synchronize immediately
|
// synchronize immediately
|
||||||
player.syncInterval = 0f;
|
player.syncInterval = 0f;
|
||||||
@ -69,9 +67,7 @@ public void TestSettingStruct()
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestSyncIntervalAndClearDirtyComponents()
|
public void TestSyncIntervalAndClearDirtyComponents()
|
||||||
{
|
{
|
||||||
GameObject gameObject = new GameObject();
|
CreateNetworked(out GameObject gameObject, out NetworkIdentity identity, out MockPlayer player);
|
||||||
|
|
||||||
MockPlayer player = gameObject.AddComponent<MockPlayer>();
|
|
||||||
player.lastSyncTime = Time.time;
|
player.lastSyncTime = Time.time;
|
||||||
// synchronize immediately
|
// synchronize immediately
|
||||||
player.syncInterval = 1f;
|
player.syncInterval = 1f;
|
||||||
@ -97,9 +93,7 @@ public void TestSyncIntervalAndClearDirtyComponents()
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestSyncIntervalAndClearAllComponents()
|
public void TestSyncIntervalAndClearAllComponents()
|
||||||
{
|
{
|
||||||
GameObject gameObject = new GameObject();
|
CreateNetworked(out GameObject gameObject, out NetworkIdentity identity, out MockPlayer player);
|
||||||
|
|
||||||
MockPlayer player = gameObject.AddComponent<MockPlayer>();
|
|
||||||
player.lastSyncTime = Time.time;
|
player.lastSyncTime = Time.time;
|
||||||
// synchronize immediately
|
// synchronize immediately
|
||||||
player.syncInterval = 1f;
|
player.syncInterval = 1f;
|
||||||
@ -126,9 +120,7 @@ public void TestSyncIntervalAndClearAllComponents()
|
|||||||
public void TestSynchronizingObjects()
|
public void TestSynchronizingObjects()
|
||||||
{
|
{
|
||||||
// set up a "server" object
|
// set up a "server" object
|
||||||
GameObject gameObject1 = new GameObject();
|
CreateNetworked(out GameObject gameObject1, out NetworkIdentity identity1, out MockPlayer player1);
|
||||||
NetworkIdentity identity1 = gameObject1.AddComponent<NetworkIdentity>();
|
|
||||||
MockPlayer player1 = gameObject1.AddComponent<MockPlayer>();
|
|
||||||
MockPlayer.Guild myGuild = new MockPlayer.Guild
|
MockPlayer.Guild myGuild = new MockPlayer.Guild
|
||||||
{
|
{
|
||||||
name = "Back street boys"
|
name = "Back street boys"
|
||||||
@ -142,9 +134,7 @@ public void TestSynchronizingObjects()
|
|||||||
identity1.OnSerializeAllSafely(true, ownerWriter, out int ownerWritten, observersWriter, out int observersWritten);
|
identity1.OnSerializeAllSafely(true, ownerWriter, out int ownerWritten, observersWriter, out int observersWritten);
|
||||||
|
|
||||||
// set up a "client" object
|
// set up a "client" object
|
||||||
GameObject gameObject2 = new GameObject();
|
CreateNetworked(out GameObject gameObject2, out NetworkIdentity identity2, out MockPlayer player2);
|
||||||
NetworkIdentity identity2 = gameObject2.AddComponent<NetworkIdentity>();
|
|
||||||
MockPlayer player2 = gameObject2.AddComponent<MockPlayer>();
|
|
||||||
|
|
||||||
// apply all the data from the server object
|
// apply all the data from the server object
|
||||||
NetworkReader reader = new NetworkReader(ownerWriter.ToArray());
|
NetworkReader reader = new NetworkReader(ownerWriter.ToArray());
|
||||||
|
Loading…
Reference in New Issue
Block a user