Exemple #1
0
        /// <summary>
        /// Returns the scale of the viewer object
        /// </summary>
        /// <param name="user">The functionality user</param>
        /// <returns>The viewer scale</returns>
        public static float GetViewerScale(this IUsesViewerScale user)
        {
#if FI_AUTOFILL
            return(default(float));
#else
            return(user.provider.GetViewerScale());
#endif
        }
Exemple #2
0
        /// <summary>
        /// Utility method for uses of IUsesViewerScale that may not have a provider, and might have a camera transform reference.
        /// If there is no provider, then it returns the lossyScale.x of the camera transform. If the transform is also null, it returns 1f.
        /// </summary>
        /// <param name="viewerScaleUser">The class that implements IUsesViewerScale and may or may not have a provider.</param>
        /// <param name="cameraTransform">The reference to a transform whose lossy scale can be used as a backup for the viewer scale.</param>
        /// <returns>The estimated scale of the current viewer. Use this to scale values that should match the scale of the viewer. </returns>
        public static float TryGetViewerScale(this IUsesViewerScale viewerScaleUser, Transform cameraTransform)
        {
            if (viewerScaleUser.HasProvider())
            {
                return(viewerScaleUser.GetViewerScale());
            }

            return(cameraTransform != null ? cameraTransform.lossyScale.x : 1f);
        }
 /// <summary>
 /// Set the scale of the viewer object
 /// </summary>
 /// <param name="scale">Uniform scale value in world space</param>
 public static void SetViewerScale(this IUsesViewerScale obj, float scale)
 {
     setViewerScale(scale);
 }
 /// <summary>
 /// Returns the scale of the viewer object
 /// </summary>
 public static float GetViewerScale(this IUsesViewerScale obj)
 {
     return(getViewerScale());
 }
Exemple #5
0
        /// <summary>
        /// Set the scale of the viewer object
        /// </summary>
        /// <param name="user">The functionality user</param>
        /// <param name="scale">Uniform scale value in world space</param>
        public static void SetViewerScale(this IUsesViewerScale user, float scale)
        {
#if !FI_AUTOFILL
            user.provider.SetViewerScale(scale);
#endif
        }
 /// <summary>
 /// Set the scale of the viewer object
 /// </summary>
 /// <param name="user">The functionality user</param>
 /// <param name="scale">Uniform scale value in world space</param>
 public static void SetViewerScale(this IUsesViewerScale user, float scale)
 {
     user.provider.SetViewerScale(scale);
 }
 /// <summary>
 /// Returns the scale of the viewer object
 /// </summary>
 /// <param name="user">The functionality user</param>
 /// <returns>The viewer scale</returns>
 public static float GetViewerScale(this IUsesViewerScale user)
 {
     return(user.provider.GetViewerScale());
 }