Exemplo n.º 1
0
            private void RegisterEntities(RailRegistry registry)
            {
                foreach (KeyValuePair <Type, Type> pair in registry.EntityTypes)
                {
                    Type entityType = pair.Key;
                    Type stateType  = pair.Value;

                    IRailPool <RailState> statePool =
                        RailResource.CreatePool <RailState>(stateType);
                    IRailPool <RailEntity> entityPool =
                        RailResource.CreatePool <RailEntity>(entityType);

                    int typeKey = this.statePools.Count + 1; // 0 is an invalid type
                    this.statePools.Add(typeKey, statePool);
                    this.EntityFactories.Add(typeKey, entityPool);
                    this.EntityTypeToKey.Add(entityType, typeKey);
                }

                this.EntityTypeCompressor =
                    new RailIntCompressor(0, this.EntityFactories.Count + 1);
            }