private void InitializeCreatureList(Creature[] allThingsInArea) { if (initialized) { Debug.LogWarning("Initialize called on CreatureBrowser when already initialized"); } creatureDropDown.ClearOptions(); List <Creature> tempMap = new List <Creature>(); List <TMP_Dropdown.OptionData> options = new List <TMP_Dropdown.OptionData>(); for (int count = 0; count < allThingsInArea.Length; count++) { if (allThingsInArea[count].match(Thing.Base_Types.CREATURE)) { TMP_Dropdown.OptionData option = new TMP_Dropdown.OptionData(allThingsInArea[count].thingName); options.Add(option); tempMap.Add(allThingsInArea[count]); } } creatureMap = tempMap.ToArray(); creatureDropDown.AddOptions(options); currentWindow = CreatureBrowserWindow.Creature_Detail_List; OnDropDownChange(); initialized = true; }
public void ReplaceCurrentWindowWith(CreatureBrowserWindow replaceWith) { if (currentWindow == replaceWith) { Debug.LogWarning("Call to replace window with already current - " + replaceWith); } currentWindow = replaceWith; }
public void Initialize(CreatureBrowserWindow startingWindow) { creatureMap = null; if (startingWindow == CreatureBrowserWindow.Creature_Detail_List) { InitializeCreatureList(Area.GetAllCreatures().ToArray()); } }
public void Initialize(CreatureBrowserWindow startingWindow) { em = Unity.Entities.World.DefaultGameObjectInjectionWorld.EntityManager; creatureMap = null; if (startingWindow == CreatureBrowserWindow.Creature_Detail_List) { NativeArray <Entity> creatures = em.CreateEntityQuery(typeof(CreatureAI)). ToEntityArray(Allocator.TempJob); InitializeCreatureList(ref creatures); creatures.Dispose(); } }
private void InitializeCreatureList(ref NativeArray <Entity> creatures) { if (creatures.Length == 0) { return; } //if (initialized) Debug.LogWarning("Initialize called on CreatureBrowser when already initialized"); creatureDropDown.ClearOptions(); List <TMP_Dropdown.OptionData> options = new List <TMP_Dropdown.OptionData>(); int creatureLength = creatures.Length; for (int count = 0; count < creatureLength; count++) { TMP_Dropdown.OptionData option = new TMP_Dropdown.OptionData(creatures[count].ToString()); options.Add(option); } creatureMap = creatures.ToArray(); creatureDropDown.AddOptions(options); currentWindow = CreatureBrowserWindow.Creature_Detail_List; OnDropDownChange(); initialized = true; }