Esempio n. 1
0
        // Token: 0x06003FDD RID: 16349 RVA: 0x00128178 File Offset: 0x00126378
        public T Add <T>() where T : class, IComponentBase, new()
        {
            ComponentType componentType = Activator.CreateInstance <T>() as ComponentType;
            string        name          = componentType.GetName();
            ComponentType componentType2;

            if (this.m_components.TryGetValue(name, out componentType2))
            {
                return((T)((object)null));
            }
            this.m_components.Add(name, componentType);
            Type       typeFromHandle = typeof(T);
            MethodInfo method         = typeFromHandle.GetMethod("Tick");

            if (method != null)
            {
                ComponenetManager <ComponentType> .TickableComponentWrapper value = new ComponenetManager <ComponentType> .TickableComponentWrapper
                {
                    Component      = componentType,
                    TickMethodInfo = method
                };
                this.m_tickableComponents.Add(typeFromHandle, value);
            }
            this.m_type2Name.Add(typeof(T), name);
            componentType.Owner = this.m_owner;
            componentType.Init();
            return(componentType as T);
        }
Esempio n. 2
0
 // Token: 0x06003FE5 RID: 16357 RVA: 0x00128514 File Offset: 0x00126714
 public void Tick(uint deltaMillisecond)
 {
     foreach (KeyValuePair <Type, ComponenetManager <ComponentType> .TickableComponentWrapper> keyValuePair in this.m_tickableComponents)
     {
         ComponenetManager <ComponentType> .TickableComponentWrapper value = keyValuePair.Value;
         value.TickMethodInfo.Invoke(value.Component, new object[]
         {
             deltaMillisecond
         });
     }
 }