Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameMap" /> class.
        /// </summary>
        /// <param name="mapDefinition">The map definition.</param>
        /// <param name="itemDropDuration">Duration of the item drop.</param>
        /// <param name="chunkSize">Size of the chunk.</param>
        public GameMap(GameMapDefinition mapDefinition, int itemDropDuration, byte chunkSize)
        {
            this.Definition       = mapDefinition;
            this.ItemDropDuration = itemDropDuration;
            this.Terrain          = new GameMapTerrain(this.Definition);

            this.areaOfInterestManager = new BucketAreaOfInterestManager(chunkSize);
            this.objectIdGenerator     = new IdGenerator(ViewExtensions.ConstantPlayerId + 1, 0x7FFF);
            this.dropIdGenerator       = new IdGenerator(0, ViewExtensions.ConstantPlayerId - 1);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameMap"/> class.
        /// </summary>
        /// <param name="mapDefinition">The map definition.</param>
        /// <param name="itemDropDuration">Duration of the item drop.</param>
        /// <param name="chunkSize">Size of the chunk.</param>
        /// <param name="itemIdStart">The item identifier start.</param>
        public GameMap(GameMapDefinition mapDefinition, int itemDropDuration, byte chunkSize, ushort itemIdStart)
        {
            this.Definition       = mapDefinition;
            this.ItemDropDuration = itemDropDuration;
            Log.DebugFormat("Creating GameMap {0}", this.Definition);
            this.Terrain = new GameMapTerrain(this.Definition);

            this.areaOfInterestManager = new BucketAreaOfInterestManager(chunkSize);
            this.freeDropIds           = new ConcurrentBag <ushort>(Enumerable.Range(itemIdStart, (ushort)(short.MaxValue - itemIdStart)).Select(id => (ushort)id));
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameMap" /> class.
        /// </summary>
        /// <param name="mapDefinition">The map definition.</param>
        /// <param name="itemDropDuration">Duration of the item drop.</param>
        /// <param name="chunkSize">Size of the chunk.</param>
        /// <param name="stateObserver">The map state observer.</param>
        public GameMap(GameMapDefinition mapDefinition, int itemDropDuration, byte chunkSize, IMapStateObserver stateObserver)
        {
            this.Definition       = mapDefinition;
            this.ItemDropDuration = itemDropDuration;
            this.stateObserver    = stateObserver;
            Log.DebugFormat("Creating GameMap {0}", this.Definition);
            this.Terrain = new GameMapTerrain(this.Definition);

            this.areaOfInterestManager = new BucketAreaOfInterestManager(chunkSize);
            this.objectIdGenerator     = new IdGenerator(ViewExtensions.ConstantPlayerId + 1, 0x7FFF);
        }