Shared.RenderData.OnDestroyed C# (CSharp) Method

OnDestroyed() public method

public OnDestroyed ( AsgardBase instance, Entity entity, bool destoryEntity = true ) : void
instance AsgardBase
entity Entity
destoryEntity bool
return void
        public override void OnDestroyed(AsgardBase instance, Entity entity, bool destoryEntity=true)
        {
            var midgard = instance.LookupSystem<Midgard>();
            var phyComp = entity.GetComponent<Physics2dComponent>();
            if (phyComp != null && phyComp.Body != null)
            {
                midgard.DeleteBody(phyComp);
            }

            ObjectMapper.DestroyEntity(entity, destoryEntity);
        }