Beispiel #1
0
        public ByteQueue ToBytes()
        {
            var bytes = new ByteQueue();

            for (int i = 0; i < states.Count; i++)
            {
                if (i > 0)
                {
                    bytes.Enqueue(DELIMITER);
                }
                bytes.Enqueue(states[i]);
            }
            return(bytes);
        }
Beispiel #2
0
        public ByteQueue ToBytes()
        {
            var bytes = new ByteQueue();

            bytes.Enqueue(tick);
            bytes.Enqueue(entities);

            foreach (var componentType in componentTypes)
            {
                foreach (var entity in entities)
                {
                    var hasComponent = entity.HasComponent(componentType);
                    bytes.Enqueue(hasComponent);
                    if (hasComponent)
                    {
                        bytes.Enqueue(entity.GetComponent(componentType));
                    }
                }
            }
            return(bytes);
        }
        public ByteQueue ToBytes()
        {
            var bytes = new ByteQueue();

            bytes.Enqueue(startStateTick);
            bytes.Enqueue(endStateTick);
            bytes.Enqueue(entityCount);
            bytes.Enqueue(spawns);
            bytes.Enqueue(despawns);
            foreach (var componentType in componentTypes)
            {
                foreach (var change in changes[componentType])
                {
                    var hasChanges = change != null;
                    bytes.Enqueue(hasChanges);
                    if (hasChanges)
                    {
                        bytes.Enqueue(change);
                    }
                }
            }
            return(bytes);
        }