This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class AudioSourceExtensions | |
{ | |
public static float CalculateVolumeAtDistance(this AudioSource source, float distance, float volumeRolloffScale = 1) | |
{ | |
var rolloff = CalculateRolloffMultipler(source, distance, volumeRolloffScale); | |
return source.volume * Mathf.Lerp(1, rolloff, source.spatialBlend); | |
} | |
public static float CalculateRolloffMultipler(this AudioSource source, float distance, float volumeRolloffScale = 1) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
namespace PopupAsylum.UIEffects | |
{ | |
/// <summary> | |
/// Aiming for feature parity with CSS box styling | |
/// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Threading.Tasks; | |
using UnityEditor; | |
using UnityEngine; | |
using UnityEngine.UIElements; | |
/// <summary> | |
/// Provides functionality for screenshotting full editor windows, and the inspector in particular |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace PopupAsylum | |
{ | |
/// <summary> | |
/// Utility functions for IMGUI Rects, useful for drawing PropertyFields in a single line | |
/// Works by returning the Rect to draw the contol and filling the out argument with a Rect for the remaining space | |
/// By passing the same Rect to the out member it can keep eating chunks of the property's Rect | |
/// | |
/// void ExampleDrawer(SerializedProperty property, Rect rect) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public static class BoundsExtensions | |
{ | |
/// <summary> | |
/// Modifies the bounds center position so that it's min and max are within the container | |
/// It doesnt modify the bounds size, if bounds are larger then the container it will be centered | |
/// </summary> | |
public static void MoveInside(ref this Bounds bounds, Bounds container) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.Rendering; | |
[ExecuteInEditMode] | |
public class Exposure : MonoBehaviour { | |
const float DEFAULT_EXPOSURE = 3f; | |
const string EXPOSURE_PROPERTY = "_PA_Exposure"; |