Пример #1
0
        /// <summary>
        /// Activate single <see cref="MapGrid"/> at position.
        /// </summary>
        private void ActivateGrid(uint gridX, uint gridZ)
        {
            var grid = new MapGrid(gridX, gridZ);

            grids[gridZ * MapDefines.WorldGridCount + gridX] = grid;

            log.Trace($"Activated grid at X:{gridX}, Z:{gridZ}.");

            foreach (EntityModel model in entityCache.GetEntities(gridX, gridZ))
            {
                // non issue once all entities types are handled
                WorldEntity entity = EntityManager.NewEntity((EntityType)model.Type) ?? EntityManager.NewEntity(EntityType.Simple);
                entity.Initialise(model);

                var vector = new Vector3(model.X, model.Y, model.Z);
                AddEntity(grid, entity, vector);
            }
        }