// Gets objects in a scene that match a certerin criteria public int Execute(HeroKitObject hko) { // Get variables heroKitObject = hko; //----------------------------------------- // Get the game objects in the scene that match specific parameters //----------------------------------------- int actionType = DropDownListValue.GetValue(heroKitObject, 0); int getHeroFieldID = 1; int objectCount = IntegerFieldValue.GetValueA(heroKitObject, 2); HeroObject heroType = HeroTypeValue.GetValue(heroKitObject, 3); // filter the hero kit objects in the scene List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsByType(HeroActionCommonRuntime.GetHeroObjectsInScene(), objectCount, heroType); // assign the hero kit objects to the list HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType); //----------------------------------------- // debugging stuff //----------------------------------------- if (heroKitObject.debugHeroObject) { string heroTypeStr = (heroType != null) ? heroType.name : ""; string countStr = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString(); string debugMessage = "Get objects assigned to this hero type: " + heroTypeStr + "\n" + "Maximum number of objects to get: " + objectCount + "\n" + "Objects found: " + countStr; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } return(-99); }
// Gets objects in a scene that match a certerin criteria public int Execute(HeroKitObject hko) { // Get variables heroKitObject = hko; eventID = heroKitObject.heroStateData.eventBlock; int actionCount = heroKitObject.heroState.heroEvent[eventID].actions.Count; //----------------------------------------- // Get the game objects in the scene that match specific parameters //----------------------------------------- int actionType = DropDownListValue.GetValue(heroKitObject, 0); int getHeroFieldID = 1; int objectCount = IntegerFieldValue.GetValueA(heroKitObject, 2); HeroObject heroType = HeroTypeValue.GetValue(heroKitObject, 3); List <HeroKitObject> listObjects = HeroObjectFieldValue.GetValueB(heroKitObject, 4); // convert list objects to array HeroKitObject[] arrayObjects = (listObjects != null) ? listObjects.ToArray() : null; // filter the hero kit objects in the scene List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsByType(arrayObjects, objectCount, heroType); // assign the hero kit objects to the list HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType); //----------------------------------------- // debugging stuff //----------------------------------------- if (heroKitObject.debugHeroObject) { string heroTypeStr = (heroType != null) ? heroType.name : ""; string countStr = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString(); string debugMessage = "Get objects assigned to this hero type: " + heroTypeStr + "\n" + "Objects found: " + countStr; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } return(-99); }