Beispiel #1
0
        public T AddCompoment <T>() where T : BaseElement, new()
        {
            T t1 = BaseElement.CreateElementWithGameObject <T>(gameObject);

            CompomentList.Add(t1);
            return(t1);
        }
Beispiel #2
0
        public void RemoveCompoment(BaseElement t1)
        {
            int index = -1;

            for (int i = 0; i < CompomentList.Count; i++)
            {
                BaseElement e1 = CompomentList[i];
                if (e1.elementID == t1.elementID)
                {
                    index = i;
                    break;
                }
            }
            if (index != -1)
            {
                CompomentList[index].Destory();
                CompomentList.RemoveAt(index);
            }
        }