/// <summary> /// Constructor. /// </summary> public HeroList() { ints = new IntList(); floats = new FloatList(); bools = new BoolList(); strings = new StringList(); gameObjects = new GameObjectList(); heroObjects = new HeroObjectList(); unityObjects = new UnityObjectList(); }
/// <summary> /// Constructor. /// </summary> /// <param name="list">The hero list to construct.</param> public HeroList(HeroList list) { visible = list.visible; ints = (list.ints == null) ? new IntList() : list.ints.Clone(list.ints); floats = (list.floats == null) ? new FloatList() : list.floats.Clone(list.floats); bools = (list.bools == null) ? new BoolList() : list.bools.Clone(list.bools); strings = (list.strings == null) ? new StringList() : list.strings.Clone(list.strings); gameObjects = (list.gameObjects == null) ? new GameObjectList() : list.gameObjects.Clone(list.gameObjects); heroObjects = (list.heroObjects == null) ? new HeroObjectList() : list.heroObjects.Clone(list.heroObjects); unityObjects = (list.unityObjects == null) ? new UnityObjectList() : list.unityObjects.Clone(list.unityObjects); }
/// <summary> /// Get a hero object template in a hero object list. /// </summary> /// <param name="list">The hero object list in a hero object.</param> /// <param name="data">Information about hero object field.</param> /// <returns>The hero object template in a hero object list.</returns> private static HeroObject GetHeroTemplate(HeroObjectList list, HeroObjectFieldData data, string listType) { int slotID = data.objectID - 1; // exit early if there is no game object list item if (slotID < 0 || slotID >= list.items.Count) { Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectInListDebugInfo(data.heroKitObject, listType, slotID)); return(null); } HeroObject targetObject = list.items[slotID].value; return(targetObject); }
/// <summary> /// Get hero kit objects in a hero object list. /// </summary> /// <param name="list">The hero object list in a hero object.</param> /// <param name="data">Information about hero object field.</param> /// <returns>The hero kit objects in a hero object list.</returns> private static HeroKitObject[] GetHeroList(HeroObjectList list, HeroObjectFieldData data, string listType) { int slotID = data.objectID - 1; HeroKitObject[] targetObject = new HeroKitObject[1]; // exit early if there is no game object list item if (slotID < 0 || slotID >= list.items.Count) { Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectInListDebugInfo(data.heroKitObject, listType, slotID)); return(targetObject); } // get the target objects if (list.items[slotID].heroKitGameObjects != null) { targetObject = list.items[slotID].heroKitGameObjects.ToArray(); } return(targetObject); }