Exemple #1
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            string          childName    = ChildObjectValue.GetValue(heroKitObject, 2, 3);
            bool            runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], childName);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Child (if used): " + childName + "\n" +
                                      "Position to Change: " + position;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Exemple #2
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            SceneObjectValueData data = SceneObjectValue.GetValue(heroKitObject, 0, 1, false);
            string childName          = ChildObjectValue.GetValue(heroKitObject, 2, 3);
            string componentName      = StringFieldValue.GetValueA(heroKitObject, 4);

            // get the game object to work with
            GameObject[] targetObject = HeroKitCommonRuntime.GetGameObjectsFromSceneObjects(data);
            bool         runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], childName, componentName);
            }

            // debug info
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Component: " + componentName + "\n" +
                                      "Child (if updating component on child): " + childName;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Exemple #3
0
        // execute this action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            string          childName    = ChildObjectValue.GetValue(heroKitObject, 2, 3);
            int             colliderType = DropDownListValue.GetValue(heroKitObject, 4);
            bool            runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], childName, colliderType);
            }

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject));
            }

            // return value
            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);
            HeroKitObject        originHKO        = HeroObjectFieldValue.GetValueA(heroKitObject, 3)[0];
            List <HeroKitObject> listObjects      = HeroObjectFieldValue.GetValueB(heroKitObject, 4);
            string               childName        = ChildObjectValue.GetValue(heroKitObject, 5, 6);
            int                  rayDirectionType = DropDownListValue.GetValue(heroKitObject, 7);
            int                  fieldOfView      = IntegerFieldValue.GetValueA(heroKitObject, 8);

            // get origin object
            GameObject originObject = null;
            Transform  transform    = null;

            if (childName == "")
            {
                transform = originHKO.transform;
            }
            else
            {
                transform = originHKO.GetHeroChildComponent <Transform>("Transform", childName);
            }

            originObject = transform.gameObject;

            // convert list objects to array
            HeroKitObject[] arrayObjects = (listObjects != null) ? listObjects.ToArray() : null;

            // filter the hero kit objects in the scene
            List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsFOV(arrayObjects, objectCount, originObject, fieldOfView, rayDirectionType);

            // assign the hero kit objects to the list
            HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType);

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string countStr     = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString();
                string name         = (originObject != null) ? originObject.name : "";
                string debugMessage = "Get objects in field of view of this object: " + name + "\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;

            //-----------------------------------------
            // 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);
            int           rayDirectionType = DropDownListValue.GetValue(heroKitObject, 4);
            float         rayDistance      = IntegerFieldValue.GetValueA(heroKitObject, 5) * 0.1f;
            int           rayType          = DropDownListValue.GetValue(heroKitObject, 6);
            bool          debugRay         = BoolValue.GetValue(heroKitObject, 9);
            GameObject    originObject     = null;
            HeroKitObject targetObject     = null;

            // ray is on a specific camera
            if (rayType == 2)
            {
                targetObject = HeroObjectFieldValue.GetValueA(heroKitObject, 3)[0];
                if (targetObject != null)
                {
                    originObject = targetObject.gameObject;
                }
            }
            // ray is on hero object
            else if (rayType == 3)
            {
                targetObject = HeroObjectFieldValue.GetValueA(heroKitObject, 3)[0];
                string childName = ChildObjectValue.GetValue(heroKitObject, 7, 8);

                Transform transform = null;
                if (childName == "")
                {
                    transform = targetObject.transform;
                }
                else
                {
                    transform = targetObject.GetHeroChildComponent <Transform>("Transform", childName);
                }

                originObject = transform.gameObject;
            }

            // filter the hero kit objects in the scene
            List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsRay2D(objectCount, targetObject, originObject, rayType, rayDirectionType, rayDistance, debugRay);

            // assign the hero kit objects to the list
            HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType);

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string countStr     = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString();
                string debugMessage = "Maximum number of objects to get: " + objectCount + "\n" +
                                      "Objects found: " + countStr;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }