/// <summary> /// if animate is false then m_factory.Release method should be called immediately /// </summary> /// <param name="animate"></param> public virtual void Kill() { if (m_voxelFactory == null) { m_voxelFactory = Dependencies.VoxelFactory; if (m_voxelFactory != null) { m_voxelFactory.Release(this); } } else { m_voxelFactory.Release(this); } }
private void DestroyVoxel(MapCell cell, VoxelData data) { if (data != null) { if (data.VoxelRef != null) { m_factory.Release(data.VoxelRef); int height = data.Height; VoxelData next = data.Next; DecreaseHeight(height, next); //#warning Could be broken ... Remove(cell.First, data.VoxelRef); cell.ForEachDescendant(descendant => { if (descendant.First != null) { DecreaseHeight(height, descendant.First); } }); } if (cell.First == data) { if (data.Next != null) { data.Next.Prev = cell.First.Prev; } cell.First = data.Next; if (cell.First == null) { cell.Last = null; } } else if (cell.Last == data) { cell.Last = data.Prev; } } }