Esempio n. 1
0
        static internal T Add <T>(ComponentObject obj) where T : GOEBaseComponent, new()
        {
            T t = obj.GetComponent <T>();

            if (null == t)
            {
                t = obj.AddComponent <T>();
            }

            return(t);
        }
Esempio n. 2
0
 static internal void EnableComponent <T>(ComponentObject obj, bool bEnable) where T : GOEBaseComponent, new()
 {
     if (bEnable)
     {
         T t = Add <T>(obj);
         t.Enable = bEnable;
     }
     else
     {
         T t = obj.GetComponent <T>();
         if (t != null)
         {
             t.Enable = bEnable;
         }
     }
 }