Exemplo n.º 1
0
    public static void SetPaused(Rigidbody2D rb, bool paused)
    {
        Rigidbody2D_ex ex = rb.gameObject.GetComponent <Rigidbody2D_ex>();

        if (!ex)
        {
            ex = rb.gameObject.AddComponent <Rigidbody2D_ex>();
        }

        ex.SetPaused(paused);
    }
Exemplo n.º 2
0
    public static void SetEnabled(GameObject go, bool enabled)
    {
        foreach (PausableRepetition script in go.GetComponentsInChildren <PausableRepetition>())
        {
            script.enabled = enabled;
        }

        foreach (Pausable script in go.GetComponentsInChildren <Pausable>())
        {
            script.enabled = enabled;
        }

        foreach (Rigidbody2D rigidbody in go.GetComponentsInChildren <Rigidbody2D>())
        {
            Rigidbody2D_ex.SetPaused(rigidbody, !enabled);
        }
    }