/// <summary> /// Get X, Y, and Z coordinates. /// This is for a field that contains Value, Variable, Property, Global. /// </summary> /// <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="actionFieldIDC">ID assigned to action field C.</param> /// <param name="actionFieldIDD">ID assigned to action field D.</param> /// <param name="actionFieldIDE">ID assigned to action field E.</param> /// <param name="actionFieldIDF">ID assigned to action field F.</param> /// <param name="startingCoords">ID assigned to action field G.</param> /// <returns>The X, Y, and Z coordinates.</returns> public static Vector3 GetValue(HeroKitObject heroKitObject, int actionFieldIDA, int actionFieldIDB, int actionFieldIDC, int actionFieldIDD, int actionFieldIDE, int actionFieldIDF, Vector3 startingCoords) { Vector3 pos = startingCoords; // get the values to update bool changeX = BoolValue.GetValue(heroKitObject, actionFieldIDA); if (changeX) { pos.x = FloatFieldValue.GetValueA(heroKitObject, actionFieldIDB); } bool changeY = BoolValue.GetValue(heroKitObject, actionFieldIDC); if (changeY) { pos.y = FloatFieldValue.GetValueA(heroKitObject, actionFieldIDD); } bool changeZ = BoolValue.GetValue(heroKitObject, actionFieldIDE); if (changeZ) { pos.z = FloatFieldValue.GetValueA(heroKitObject, actionFieldIDF); } return(pos); }
/// <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); }
/// <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); }