Example #1
0
        internal void AddLoadedComponent(LoadedComponent component)
        {
            components.Add(component);
            componentSet.Add(component.Type);
            componentDict[component.Type] = component;
            foreach (Type type in ClassFactory.GetRequirements(component.Type))
            {
                needs.Add(type);
            }

            foreach (Type type in ClassFactory.GetProvided(component.Type))
            {
                componentSet.Add(type);
            }
        }
Example #2
0
        internal LoadedEntity entityParse(object entity, string name, int id)
        {
            List<string> isType = new List<string>();
            List<string> isExactType = new List<string>();
            IEnumerable<object> components = loaderUtility.GetOfType(entity, loaderUtility.ComponentType);
            IEnumerable<object> events = loaderUtility.GetOfType(entity, loaderUtility.EventType);
            PropertyHolder entityProperties = loaderUtility.GetProperties(entity);
            IEnumerable<string> prototypes = loaderUtility.GetPrototypes(entity);

            LoadedEntity loadedEntity = new LoadedEntity(name, entityProperties, id, prototypes, loaderUtility);

            foreach (object component in components)
            {
                PropertyHolder componentProperties = loaderUtility.GetProperties(component);
                string type = loaderUtility.GetType(component);
                LoadedComponent lc = new LoadedComponent(type, componentProperties, loaderUtility);
                loadedEntity.AddLoadedComponent(lc);
            }

            foreach (object evt in events) createEvent(Game, evt, loadedEntity);

            loadedEntity.Prepare();
            return loadedEntity;
        }