void ReceiveInitialData(NetIncomingMessage message) { byte count = message.ReadByte(); for (int i = 0; i < count; i++) { HeroInitialData init = HeroInitialData.ReadData(message); HeroSyncData sync = HeroSyncData.ReadData(message); ObjectManager.AddHero(init, sync, false); } count = message.ReadByte(); for (int i = 0; i < count; i++) { CoreInitialData init = CoreInitialData.ReadData(message); CoreSyncData sync = CoreSyncData.ReadData(message); ObjectManager.AddCore(init, sync); } count = message.ReadByte(); for (int i = 0; i < count; i++) { TowerInitialData init = TowerInitialData.ReadData(message); TowerSyncData sync = TowerSyncData.ReadData(message); ObjectManager.AddTower(init, sync); } }
void ReadSnapshot(NetIncomingMessage message) { byte count = message.ReadByte(); for (int i = 0; i < count; i++) { HeroInitialData init = HeroInitialData.ReadData(message); HeroSyncData sync = HeroSyncData.ReadData(message); ObjectManager.UpdateHero(init, sync); } count = message.ReadByte(); for (int i = 0; i < count; i++) { CoreSyncData sync = CoreSyncData.ReadData(message); ObjectManager.UpdateCore(sync); } count = message.ReadByte(); for (int i = 0; i < count; i++) { TowerSyncData sync = TowerSyncData.ReadData(message); ObjectManager.UpdateTower(sync); } count = message.ReadByte(); List <SyncData> monsters = new List <SyncData>(); for (int i = 0; i < count; i++) { monsters.Add(MonsterSyncData.ReadData(message)); } ObjectManager.UpdateMonsters(monsters); count = message.ReadByte(); List <SyncData> minions = new List <SyncData>(); for (int i = 0; i < count; i++) { minions.Add(MinionSyncData.ReadData(message)); } ObjectManager.UpdateMinions(minions); count = message.ReadByte(); List <SyncData> abilities = new List <SyncData>(); for (int i = 0; i < count; i++) { abilities.Add(AbilitySyncData.ReadData(message)); } ObjectManager.UpdateAbilities(abilities); count = message.ReadByte(); for (int i = 0; i < count; i++) { Bullet bullet = Bullet.ReadData(message); ObjectManager.AddBullet(bullet); } }