This file contains 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.Runtime.CompilerServices; | |
using UnityEngine; | |
/// <summary> | |
/// Convert linear 0.0f - 1.0f values to some other non-linear value. | |
/// </summary> | |
public static class Interpolation | |
{ | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
public static float Boing(float v) => (Mathf.Sin(v * Mathf.PI * (0.2f + 2.5f * v * v * v)) * Mathf.Pow(1f - v, 2.2f) + v) * (1f + (1.2f * (1f - v))); |
This file contains 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.Collections.Generic; | |
using UnityEngine; | |
public class ComponentPool<T> where T : Component | |
{ | |
static ComponentPool<T> Instance = new ComponentPool<T>(); | |
Dictionary<int, Stack<T>> pools = new Dictionary<int, Stack<T>>(); | |
Dictionary<int, int> instances = new Dictionary<int, int>(); |
This file contains 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 UnityEditor; | |
using System.Reflection; | |
[InitializeOnLoad] | |
public static class SceneContext | |
{ | |
static System.Diagnostics.Stopwatch clickClock; |
This file contains 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.Collections; | |
using System.Collections.Generic; | |
using UnityEditor; | |
using UnityEngine; | |
public class PaletteWizard : ScriptableWizard | |
{ | |
public Texture2D sourceImage; | |
[Range(1, 5)] |
This file contains 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.Collections; | |
using System.Collections.Generic; | |
using UnityEditor; | |
using UnityEngine; | |
public static class CommandGizmos | |
{ | |
static GUIStyle sceneNote; | |
static CommandGizmos() |
This file contains 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
[Serializable] | |
public class MyClass { | |
public int id; | |
} | |
[CustomPropertyDrawer(typeof(MyClass))] | |
public class MyClassDrawer : PropertyDrawer | |
{ | |
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | |
{ |
This file contains 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
float Sin(float x) | |
{ | |
while (x < -3.14159265f) | |
x += 6.28318531f; | |
while (x > 3.14159265f) | |
x -= 6.28318531f; | |
float sin; | |
var xZ = x < 0 ? -1 : 1; | |
sin = 1.27323954f * x - xZ * .405284735f * x * x; | |
var sinZ = sin < 0 ? -1 : 1; |
This file contains 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.Collections.Generic; | |
using UnityEngine; | |
public abstract class MonoBehaviourSystem<T> : MonoBehaviour where T : MonoBehaviourComponent<T> | |
{ | |
protected abstract void UpdateBatch(Queue<T> components); | |
void Update() | |
{ | |
UpdateBatch(ComponentBatch<T>.components); |
This file contains 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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
public class AssetForgePostProcessor : AssetPostprocessor | |
{ |
This file contains 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
/// <summary> | |
/// This is a pubsub system used for coordinating loosely coupled systems. | |
/// It does some tricks with an internal class to improve the appearance | |
/// of the public API. | |
/// </summary> | |
public static class GameEvent | |
{ | |
/* Public API */ | |
public static void Publish<T>(T ev) => _InternalGameEvent<T>.Publish(ev); |
OlderNewer