Beispiel #1
0
        public Entity AddComponent <T>() where T : Component
        {
            Type[] oldComponents = GetAllComponents();
            T      component     = (T)Activator.CreateInstance(typeof(T));

            component.SetEntity(this);
            int position = componentManager.Add(component);

            components[typeof(T)] = position;
            archetypes.ChangeArchetype(this, oldComponents);
            return(this);
        }