static void drawEntityOverview(UnityEntityManager entityManager) { CustomEditorLayout.BeginVerticalBox(); { EditorGUILayout.LabelField("General", EditorStyles.boldLabel); EditorGUILayout.LabelField("Entities", entityManager.TotalEntities.ToString()); EditorGUILayout.LabelField("Component Types", entityManager.TotalComponentTypes.ToString()); } CustomEditorLayout.EndVertical(); }
public GameObjectEntity CreateRandomPiece(UnityEntityManager entityManager, int x, int y, GameObject _gameObject) { Entity entity = entityManager.CreateEntity(); GameObject gameObject = new GameObject("Entity-" + x + y); gameObject.transform.SetParent(_gameObject.transform); GameObjectEntity goEntity = gameObject.AddComponent <GameObjectEntity>(); goEntity.SetEntity(entity, entityManager); entityManager.AddComponent(entity, new Position(new IntVector2(x, y))); return(goEntity); }
public void Initialize() { utilityComponent = Instantiate(utilityPrefab, this.transform).GetComponent <Utility>(); utilityComponent.Initialize(maps[ScoreService.Level]); blockManagerComponent = Instantiate(blockManagerPrefab, this.transform).GetComponent <UnityBlockManager>(); blockManagerComponent.BuildNewLevel(maps[ScoreService.Level]); entityManagerComponent = Instantiate(entityManagerPrefab, this.transform).GetComponent <UnityEntityManager>(); entityManagerComponent.BuildNewLevel( maps[ScoreService.Level], blockManagerComponent.manager.chunks, blockManagerComponent.unityBlockChunks, blockManagerComponent.Fires); music.StopClip(); music.PlayClip(music.musicIntro); }
static void drawEntityList(UnityEntityManager entityManager) { CustomEditorLayout.BeginVerticalBox(); EditorGUILayout.LabelField("Entity Inspector", EditorStyles.boldLabel); _filteredComponents = CustomEditorLayout.SearchTextField(_filteredComponents); IEnumerable <string> componentNames = _filteredComponents.Split('-', ' ', ';', ',') .Where(name => !string.IsNullOrEmpty(name)) .Select(name => name.ToLower()); foreach (EntityInfo entityInfo in entityManager.EntityList) { IEnumerable <IComponent> components = entityManager.GetComponents(entityInfo); entityInfo.Name = "{" + string.Join("} - {", components.Select(x => x.GetType().Name).ToArray()) + "}"; var entityName = entityInfo.Name.ToLower(); if (componentNames.Any() && componentNames.Where(name => entityName.Contains(name)).Count() != componentNames.Count()) { continue; } entityInfo.expanded = EditorGUILayout.BeginToggleGroup(entityInfo.Name, entityInfo.expanded); EditorGUI.indentLevel++; if (entityInfo.expanded) { foreach (IComponent component in components) { var style = GetColoredBoxStyle(component); EditorGUILayout.BeginVertical(style, GUILayout.Height(50)); EditorGUILayout.LabelField(component.GetType().Name, EditorStyles.boldLabel); EditorGUILayout.EndVertical(); } } EditorGUI.indentLevel--; EditorGUILayout.EndToggleGroup(); } CustomEditorLayout.EndVertical(); }
public void Init(UnityEntityManager entityManager) { _entityManager = entityManager; }