Exemple #1
0
        private void DISEntityLeft(DISReflectedEntity disReflectedEntity)
        {
            ReflectedEntity reflectedEntity;

            if (_reflectedEntities.TryGetValue(disReflectedEntity, out reflectedEntity))
            {
                EntityLeft?.Invoke(reflectedEntity);
                Destroy(reflectedEntity.gameObject);
                _reflectedEntities.Remove(disReflectedEntity);
            }
        }
        public void OnEntityUnregistered(object sender, EntityRegistryComponent.EntityEventArgs e)
        {
            this.Log($"Location unregistering {e.Entity}");

            e.Entity.SetLocation(null);

            if (AssociatedMap)
            {
                this.Log($"Location relocating {e.Entity} from {AssociatedMap} to {ContainingMap}");

                AssociatedMap.EntityRegistry.Unregister(e.Entity);
                ContainingMap.EntityRegistry.Register(e.Entity);
            }

            EntityLeft?.Invoke(this, new EntityRegistryComponent.EntityEventArgs(e.Entity));
        }