protected override void OnWorldSelected(World world) { if (world == World) { return; } if (Strategy != null) { EntityHierarchyDiffSystem.Unregister(this); Strategy.Dispose(); Strategy = null; } World = world; if (World != null) { Strategy = new EntityHierarchyDefaultGroupingStrategy(world); EntityHierarchyDiffSystem.Register(this); m_EntityHierarchy.Refresh(this); } else { m_EntityHierarchy.Clear(); } }
protected override void OnWorldSelected(World world) { if (world == World) { return; } State?.Dispose(); GroupingStrategy?.Dispose(); m_EntityHierarchyDiffer?.Dispose(); State = null; GroupingStrategy = null; m_EntityHierarchyDiffer = null; World = world; if (World != null) { // TODO: How do we instantiate the correct State/Strategy combination? // TODO: Should we even allow the State to be overridable by users? State = new EntityHierarchyState(world); GroupingStrategy = new EntityHierarchyDefaultGroupingStrategy(world, State); m_EntityHierarchyDiffer = new EntityHierarchyDiffer(this, DisableDifferCooldownPeriod ? 0 : 16); m_EntityHierarchy.Refresh(this); } else { m_EntityHierarchy.Clear(); } }