public List <GameObject> GetCreaturesByName(string _name) { CreatureGroupObject _group = CreatureRegister.GetCreatureGroup(_name); if (_group != null && _group.Creatures.Count > 0) { return(_group.Creatures); } else { List <GameObject> _creatures = new List <GameObject>(); foreach (CreatureReferenceObject _item in ReferenceCreatures) { if (_item.Creature != null) { if (_name.Length == 0 || _item.Creature.name == _name) { _creatures.Add(_item.Creature); } } } return(_creatures); } }
protected override void Deregister() { if (CreatureRegister.Deregister(transform.gameObject)) { Message.SetReferenceGroup(null); } }
public static void QuickSelectionPopup(string _title, ICECreatureEntity _entity) { ICECreatureRegister _register = ICECreatureRegister.Instance; if (_register == null) { } else { ICEEditorLayout.BeginHorizontal(); int _new_index = Popups.QuickSelectionPopup(_title, QuickSelectIndex); if (_register.ReferenceGroupObjects.Count > 0) { int _own_index = CreatureRegister.GetReferenceIndexByName(_entity.name); if (_new_index != _own_index) { QuickSelectIndex = _new_index; QuickSelectGroup = _register.ReferenceGroupObjects[QuickSelectIndex]; } if (ICEEditorLayout.DebugButton("SELECT", "Activates the displayed GameObject. You can use this funtion to switch between your objects.") && _new_index < _register.ReferenceGroupObjects.Count) { if (_entity != null) { QuickSelectIndex = CreatureRegister.GetReferenceIndexByName(_entity.name); } Selection.activeGameObject = _register.ReferenceGroupObjects[_new_index].ReferenceGameObject; } } else { if (ICEEditorLayout.DebugButton("UPDATE", "Updates the register by scanning the scene for relevant objects")) { _register.UpdateReferences(); } } if (ICEEditorLayout.DebugButton("REGISTER", "Switches the focus to the Creature Register")) { Selection.activeGameObject = _register.gameObject; } if (QuickSelectGroup == null || QuickSelectGroup.EntityType != _entity.EntityType) { EditorGUI.BeginDisabledGroup(true); ICEEditorLayout.DebugButton("COPY", "Copys the settings from the selected entity to this one. Both entities must be from the same type!"); EditorGUI.EndDisabledGroup(); } else { if (ICEEditorLayout.DebugButton("COPY", "Copies the settings from the selected entity to this one. Both entities must be from the same type!")) { string _warning = "Please note, this function copies the settings from the selected entity (" + QuickSelectGroup.Name + ") to this one (" + _entity.name + "). This overwrites all settings " + "of this entity. Are you sure you want to do that? \n\n" + "Press COPY to continue or CANCEL to abort."; if (EditorUtility.DisplayDialog("Copy Message", _warning, "COPY", "CANCEL")) { UnityEditorInternal.ComponentUtility.CopyComponent(QuickSelectGroup.EntityComponent); UnityEditorInternal.ComponentUtility.PasteComponentValues(_entity); } } } ICEEditorLayout.EndHorizontal(Info.ENTITY_QUICK_SELECTION); } }
public void DestroyGroup() { CreatureRegister.DestroyGroup("EthanRedEscortFollower"); }
/// <summary> /// Removes this instance according to the defined reference group settings of the /// CreatureRegister. In cases UseSoftRespawn is active the target will be dactivate, /// stored and prepared for its next action, otherwise the object will be destroyed. /// </summary> protected override void Remove() { CreatureRegister.Remove(transform.gameObject); }
protected override void Register() { Message.SetReferenceGroup(CreatureRegister.Register(transform.gameObject)); }
void Start() { CreatureRegister.Register(gameObject); }
void OnDestroy() { CreatureRegister.Deregister(gameObject); }