public static void Destroy(GameObject gameObject) { var egoComponent = gameObject.GetComponent <EgoComponent>(); EgoEvents <DestroyedGameObject> .AddEvent(new DestroyedGameObject( gameObject, egoComponent )); EgoCleanUp.Destroy(gameObject); }
public static void DestroyGameObject(EgoComponent egoComponent) { var gameObject = egoComponent.gameObject; EgoEvents <DestroyedGameObject> .AddEvent(new DestroyedGameObject( gameObject, egoComponent )); EgoCleanUp.Destroy(egoComponent.gameObject); }
public static bool Destroy <C>(GameObject gameObject) where C : Component { var egoComponent = gameObject.GetComponent <EgoComponent>(); C component = null; if (egoComponent.TryGetComponents <C>(out component)) { var e = new DestroyedComponent <C>(component, egoComponent); EgoEvents <DestroyedComponent <C> > .AddEvent(e); EgoCleanUp <C> .Destroy(egoComponent, component); return(true); } return(false); }
public static bool DestroyComponent <C>(EgoComponent egoComponent) where C : Component { C component = null; if (!egoComponent.TryGetComponents <C>(out component)) { return(false); } var e = new DestroyedComponent <C>(component, egoComponent); EgoEvents <DestroyedComponent <C> > .AddEvent(e); EgoCleanUp <C> .Destroy(egoComponent, component); return(true); }