private void DeserializeWorldPosition(EntityManager entityManager, Entity entity, bool componentOwnership, AbsoluteSimulationFrame simulationFrame, Coherence.Replication.Protocol.Definition.IInBitStream protocolStream, bool justCreated, IInBitStream bitStream)
        {
            // If we own the entity, don't overwrite with downstream data from server
            // TODO: Server should never send downstream to the simulating client
            if (componentOwnership)
            {
                // Read and discard data (the stream must always be read)
                var temp = new Translation();
                unityReaders.Read(ref temp, protocolStream);
                return;
            }


            // Ensure entities with interpolation also have Interpolation components and Sample components
            if (!entityManager.HasComponent <InterpolationComponent_Translation>(entity))
            {
                entityManager.AddComponent <InterpolationComponent_Translation>(entity);
                entityManager.AddComponent <Sample_Translation>(entity);
            }

            // Append buffer for components that use interpolation
            var tempComponentData = new Translation();

            unityReaders.Read(ref tempComponentData, protocolStream);
            if (justCreated)             // Hack
            {
                entityManager.SetComponentData(entity, tempComponentData);
            }
            InterpolationSystem_Translation.AppendBuffer(entity, tempComponentData, entityManager.World, (ulong)simulationFrame.Frame);
        }
Ejemplo n.º 2
0
        private void DeserializeWorldPosition(Coherence.Replication.Protocol.Definition.IInBitStream protocolStream)
        {
            var ignored = new Translation();

            unityReaders.Read(ref ignored, protocolStream);
        }