Exemple #1
0
        public void ProcessReplicationCreate(MyPacket packet)
        {
            m_receiveStream.ResetRead(packet);

            TypeId    typeId     = m_receiveStream.ReadTypeId();
            NetworkId networkID  = m_receiveStream.ReadNetworkId();
            byte      groupCount = m_receiveStream.ReadByte();

            var pendingReplicable = new MyPendingReplicable();

            for (int i = 0; i < groupCount; i++)
            {
                var id = m_receiveStream.ReadNetworkId();
                pendingReplicable.StateGroupIds.Add(id);
            }

            Type          type       = GetTypeByTypeId(typeId);
            IMyReplicable replicable = (IMyReplicable)Activator.CreateInstance(type);

            pendingReplicable.DebugObject = replicable;
            pendingReplicable.IsStreaming = false;

            m_pendingReplicables.Add(networkID, pendingReplicable);

            replicable.OnLoad(m_receiveStream, (loaded) => SetReplicableReady(networkID, replicable, loaded));
        }