Destroy() public static method

public static Destroy ( GameObject gameObject ) : void
gameObject GameObject
return void
Exemplo n.º 1
0
    public static void Destroy(GameObject gameObject)
    {
        var egoComponent = gameObject.GetComponent <EgoComponent>();

        EgoEvents <DestroyedGameObject> .AddEvent(new DestroyedGameObject( gameObject, egoComponent ));

        EgoCleanUp.Destroy(gameObject);
    }
Exemplo n.º 2
0
    public static void DestroyGameObject(EgoComponent egoComponent)
    {
        var gameObject = egoComponent.gameObject;

        EgoEvents <DestroyedGameObject> .AddEvent(new DestroyedGameObject( gameObject, egoComponent ));

        EgoCleanUp.Destroy(egoComponent.gameObject);
    }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
    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);
    }