예제 #1
0
        public void Track(DreamTunnelEntry entity, int depth)
        {
            // Create new renderer with specific depth if doesn't exist, or get the older one otherwise.
            if (!renderers.TryGetValue(depth, out CustomDepthRenderer renderer))
            {
                renderers.Add(depth, renderer = new CustomDepthRenderer(depth));
                entity.Scene.Add(renderer);
            }

            // Add entity
            renderer.list.Add(entity);
        }
예제 #2
0
        public void Untrack(DreamTunnelEntry entity, int depth)
        {
            if (renderers.TryGetValue(depth, out CustomDepthRenderer renderer))
            {
                renderer.list.Remove(entity);

                if (renderer.list.Count == 0)
                {
                    // No entity with this renderer's depth exist, get rid of it.
                    renderers.Remove(depth);
                    renderer.RemoveSelf();
                }
            }
        }