Ejemplo n.º 1
0
        // 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);
        }
        // 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);
        }