Beispiel #1
0
            private void RegisterEvents(RailRegistry registry)
            {
                foreach (Type eventType in registry.EventTypes)
                {
                    IRailPool <RailEvent> statePool =
                        RailResource.CreatePool <RailEvent>(eventType);

                    int typeKey = this.eventPools.Count + 1; // 0 is an invalid type
                    this.eventPools.Add(typeKey, statePool);
                    this.EventTypeToKey.Add(eventType, typeKey);
                }

                this.EventTypeCompressor =
                    new RailIntCompressor(0, this.eventPools.Count + 1);
            }
Beispiel #2
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);
            }
Beispiel #3
0
 private void RegisterCommand(RailRegistry registry)
 {
     this.commandPool =
         RailResource.CreatePool <RailCommand>(registry.CommandType);
 }