Destroy() public static method

public static Destroy ( GameObject gameObject ) : void
gameObject GameObject
return void
示例#1
0
文件: Ego.cs 项目: ctxdegithub/EgoCS
    public static void Destroy(GameObject gameObject)
    {
        var egoComponent = gameObject.GetComponent <EgoComponent>();

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

        EgoCleanUp.Destroy(gameObject);
    }
示例#2
0
    public static void DestroyGameObject(EgoComponent egoComponent)
    {
        var gameObject = egoComponent.gameObject;

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

        EgoCleanUp.Destroy(egoComponent.gameObject);
    }
示例#3
0
文件: Ego.cs 项目: ctxdegithub/EgoCS
    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);
    }
示例#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);
    }