Example #1
0
        /// <summary>
        /// Handles the cleanup process for a landblock
        /// This method is called by LandblockManager
        /// </summary>
        public void Unload()
        {
            var landblockID = Id.Raw | 0xFFFF;

            //Console.WriteLine($"Landblock.Unload({landblockID:X})");
            SaveDB();

            // remove all objects
            foreach (var wo in worldObjects.Keys.ToList())
            {
                RemoveWorldObjectInternal(wo);
            }

            // remove physics landblock
            LScape.unload_landblock(landblockID);

            // dungeon landblocks do not handle adjacents
            if (_landblock.IsDungeon)
            {
                return;
            }

            // notify adjacents
            foreach (var adjacent in adjacencies.Where(adj => adj.Value != null))
            {
                adjacent.Value.UnloadAdjacent(AdjacencyHelper.GetInverse(adjacent.Key), this);
            }

            // TODO: cleanup physics landblock references
        }
Example #2
0
        /// <summary>
        /// Handles the cleanup process for a landblock
        /// This method is called by LandblockManager
        /// </summary>
        public void Unload()
        {
            //Console.WriteLine("Landblock.Unload(" + (Id.Raw | 0xFFFF).ToString("X8") + ")");
            SaveDB();

            // dungeon landblocks do not handle adjacents
            if (_landblock.IsDungeon)
            {
                return;
            }

            // notify adjacents
            foreach (var adjacent in adjacencies.Where(adj => adj.Value != null))
            {
                adjacent.Value.UnloadAdjacent(AdjacencyHelper.GetInverse(adjacent.Key), this);
            }

            // TODO: cleanup physics landblock references
        }