예제 #1
0
        /// <summary>
        /// Get a camera.
        /// This is for a field that contains Value, Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the camera field.</param>
        /// <param name="actionFieldIDA">ID assigned to action field A.</param>
        /// <param name="actionFieldIDB">ID assigned to action field B.</param>
        /// <returns></returns>
        public static Camera GetValue(HeroKitObject heroKitObject, int actionFieldIDA, int actionFieldIDB)
        {
            Camera camera = null;

            // get the camera
            bool customCamera = BoolValue.GetValue(heroKitObject, actionFieldIDA);

            if (customCamera)
            {
                HeroKitObject cameraObject = HeroObjectFieldValue.GetValueA(heroKitObject, actionFieldIDB)[0];
                if (cameraObject != null)
                {
                    camera = cameraObject.GetHeroComponent <Camera>("Camera", true);
                }
            }
            else
            {
                camera = Camera.main;
            }

            return(camera);
        }
예제 #2
0
        /// <summary>
        /// Get a list of hero kit objects in a hero object field.
        /// By default this hero kit object is used.
        /// </summary>
        /// <remarks>By default, this method always returns an array with one value. The values in the array may be null, but the array itself will never be null.</remarks>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldIDA">ID assigned to action field A.</param>
        /// <param name="actionFieldIDB">ID assigned to action field B.</param>
        /// <param name="canReturnNull">A null array can be returned.</param>
        /// <returns>A list of hero kit objects in a hero object field.</returns>
        public static HeroKitObject[] GetValueE(HeroKitObject heroKitObject, int actionFieldIDA, int actionFieldIDB, bool canReturnNull = true)
        {
            bool useAnotherObject = BoolValue.GetValue(heroKitObject, actionFieldIDA);

            HeroKitObject[] targetObject = new HeroKitObject[1];
            if (useAnotherObject)
            {
                targetObject = GetValueA(heroKitObject, actionFieldIDB);
            }
            else
            {
                targetObject[0] = heroKitObject;
            }

            if (canReturnNull)
            {
                if (targetObject.Length == 1 && targetObject[0] == null)
                {
                    targetObject = null;
                }
            }

            return(targetObject);
        }