public override void WindowGUI() { if (GUILayout.Button("Specific object")) { EntityPickerGUI picker = gameObject.AddComponent <EntityPickerGUI>(); picker.voxelArray = voxelArray; picker.allowNone = false; picker.allowMultiple = false; picker.handler = (ICollection <Entity> entities) => { if (entities.Count > 0) { foreach (Entity entity in entities) // only first one { handler(new ActivatedSensor.EntityFilter(entity)); return; } } }; Destroy(this); } if (GUILayout.Button("Object type")) { TypePickerGUI picker = gameObject.AddComponent <TypePickerGUI>(); picker.title = "Filter by object type"; picker.categories = new PropertiesObjectType[][] { GameScripts.entityFilterTypes }; picker.handler = (PropertiesObjectType type) => { handler(new ActivatedSensor.EntityTypeFilter(type)); }; Destroy(this); } if (GUILayout.Button("Active behavior type")) { TypePickerGUI picker = gameObject.AddComponent <TypePickerGUI>(); picker.title = "Filter by behavior type"; picker.categoryNames = GameScripts.behaviorTabNames; picker.categories = GameScripts.behaviorTabs; picker.handler = (PropertiesObjectType type) => { handler(new ActivatedSensor.EntityTypeFilter(type)); }; Destroy(this); } if (GUILayout.Button("Tag")) { TagPickerGUI picker = gameObject.AddComponent <TagPickerGUI>(); picker.title = "Filter by tag"; picker.handler = (byte tag) => { handler(new ActivatedSensor.TagFilter(tag)); }; Destroy(this); } }
private void SelectByTagInterface() { TagPickerGUI tagPicker = gameObject.AddComponent <TagPickerGUI>(); tagPicker.title = "Select by tag"; tagPicker.handler = (byte tag) => { voxelArray.ClearSelection(); voxelArray.SelectAllWithTag(tag); }; }
public static void Tag(Property property) { string tagString = Entity.TagToString((byte)property.value); GUILayout.BeginHorizontal(); AlignedLabel(property); GUILayout.FlexibleSpace(); if (GUILayout.Button(" " + tagString + " ", tagFieldStyle.Value, GUILayout.ExpandWidth(false))) { TagPickerGUI picker = GUIPanel.guiGameObject.AddComponent<TagPickerGUI>(); picker.title = "Change " + property.name; picker.handler = (byte tag) => { property.value = tag; }; } GUILayout.EndHorizontal(); }