// 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); HeroKitProperty heroProperty = HeroPropertyValue.GetValue(heroKitObject, 3); // filter the hero kit objects in the scene List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsByProperty(HeroActionCommonRuntime.GetHeroObjectsInScene(), objectCount, heroProperty); // assign the hero kit objects to the list HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType); //----------------------------------------- // debugging stuff //----------------------------------------- if (heroKitObject.debugHeroObject) { string propertyStr = (heroProperty != null) ? heroProperty.name : ""; string countStr = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString(); string debugMessage = "Get objects assigned to this hero property: " + propertyStr + "\n" + "Maximum number of objects to get: " + objectCount + "\n" + "Objects found: " + countStr; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } return(-99); }
/// <summary> /// Get a hero kit property. /// </summary> /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param> /// <param name="actionFieldID">ID assigned to action field A.</param> /// <returns>The hero kit property.</returns> public static HeroKitProperty GetValue(HeroKitObject heroKitObject, int actionFieldID) { // Get the action HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action]; // Get the value HeroKitProperty value = action.actionFields[actionFieldID].heroProperties[0]; // Return the value return(value); }
// -------------------------------------------------------------- // Methods (General) // -------------------------------------------------------------- /// <summary> /// Block in which to display the main menu. /// </summary> /// <param name="heroKitProperty">Hero property info to display in the menu.</param> /// <param name="heroKitEditor">Hero kit editor.</param> public static void Block(HeroKitProperty heroKitProperty, HeroKitEditor heroKitEditor) { // exit early if object is null if (heroKitProperty == null) { return; } // save the editor heroEditor = heroKitEditor; // draw components DrawBlock(); }
/// <summary> /// Block to display on the canvas. Get list from hero kit property. /// </summary> /// <param name="heroKitObject">Hero object info to display in the block.</param> public static void Block(HeroKitProperty heroKitProperty) { // exit early if object is null if (heroKitProperty == null) { return; } // assign hero object to this class items = heroKitProperty.properties.bools.items; // draw components DrawHeader(); DrawBlock(); }
// 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); HeroKitProperty heroProperty = HeroPropertyValue.GetValue(heroKitObject, 3); List <HeroKitObject> list = HeroObjectFieldValue.GetValueB(heroKitObject, 4); List <HeroKitObject> filteredObjects = null; if (list != null) { HeroKitObject[] listObjects = list.ToArray(); // filter the hero kit objects in the scene filteredObjects = HeroActionCommonRuntime.GetHeroObjectsByProperty(listObjects, objectCount, heroProperty); // assign the hero kit objects to the list HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType); } //----------------------------------------- // debugging stuff //----------------------------------------- if (heroKitObject.debugHeroObject) { string propertyStr = (heroProperty != null) ? heroProperty.name : ""; string countStr = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString(); string debugMessage = "Get objects assigned to this hero property: " + propertyStr + "\n" + "Objects found: " + countStr; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } return(-99); }
/// <summary> /// Click Edit button in hero kit property inspector. /// </summary> /// <param name="selectedAsset"></param> public static void ButtonClickHeroPropertyAsset(HeroKitProperty selectedAsset) { heroType = 2; heroKitProperty = selectedAsset; ShowWindow(); }
/// <summary> /// Constructor. /// </summary> /// <param name="list">The hero property to construct.</param> public HeroProperties(HeroProperties field) { propertyTemplate = field.propertyTemplate; itemProperties = field.itemProperties.Clone(field.itemProperties); }
/// <summary> /// Actions to perform when the hero kit property is enabled. /// </summary> private void OnEnable() { heroKitProperty = (HeroKitProperty)target; }