From 2357aa2da511f39ccec055e3ea5a727a74b2059b Mon Sep 17 00:00:00 2001 From: teascade Date: Tue, 9 May 2017 17:22:52 +0300 Subject: [PATCH] Put Character on CConnectedPlayer finally to use --- Assets/Scripts/Networking/Clientside/Client.cs | 5 ++++- Assets/Scripts/Networking/Clientside/SyncHandler.cs | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Networking/Clientside/Client.cs b/Assets/Scripts/Networking/Clientside/Client.cs index 8a40e6f..f687d8b 100644 --- a/Assets/Scripts/Networking/Clientside/Client.cs +++ b/Assets/Scripts/Networking/Clientside/Client.cs @@ -168,7 +168,10 @@ namespace Cyber.Networking.Clientside { // Change it into a PC instead. EntityType = EntityType.PC; } - Spawner.Spawn(EntityType, SpawnPkt.Position, SpawnPkt.SyncBaseIDList); + GameObject Obj = Spawner.Spawn(EntityType, SpawnPkt.Position, SpawnPkt.SyncBaseIDList); + if (SpawnPkt.OwnerID > -1) { + Players[SpawnPkt.OwnerID].Character = Obj.GetComponent(); + } break; case (PktType.MoveCreature): MoveCreaturePkt MoveCreature = new MoveCreaturePkt(); diff --git a/Assets/Scripts/Networking/Clientside/SyncHandler.cs b/Assets/Scripts/Networking/Clientside/SyncHandler.cs index b070508..3599bbd 100644 --- a/Assets/Scripts/Networking/Clientside/SyncHandler.cs +++ b/Assets/Scripts/Networking/Clientside/SyncHandler.cs @@ -33,7 +33,6 @@ namespace Cyber.Networking.Clientside { if (LatestSyncID < SyncPacket.SyncPacketID) { LatestSyncID = SyncPacket.SyncPacketID; SyncPacket.ApplySync(message.reader); - Debug.Log("Applied Sync " + LatestSyncID); } // Otherwise disregard the sync.