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.IO; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine.UIElements; | |
class PathApi { | |
public string MonoPath; | |
public string Dir() { |
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
async Routine EnabledDisabledFlow() { | |
while (true) { | |
await Routine.Yield; | |
if (!enabled) | |
await Routine.TryAwait(() => enabled) | |
.Configure(child: DisabledFlow()); | |
await Routine.TryAwait(() => !enabled) | |
.Configure(child: EnabledFlow()); |
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
static RenderTexture TopDownPreview(GameObject prefab, RenderTexture rt, Camera Camera, Transform Root) { | |
var instance = Object.Instantiate(prefab, Root); | |
instance.hideFlags = HideFlags.DontSave; | |
Camera.targetTexture = rt; | |
Camera.Render(); | |
Object.DestroyImmediate(instance); | |
Camera.targetTexture = null; | |
return rt; | |
} |
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.Runtime.CompilerServices; | |
static class HashUtils { | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
public static int CombineWith(this int hash1, int hash2) => (hash1 * 397) ^ hash2; | |
} |
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
const string s_Arrow0 = "iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuNWWFMmUAAACYSURBVDhPzZExDoQwDATzE4oU4QXXcgUFj+YxtETwgpMwXuFcwMFSRMVKKwzZcWzhiMg91jtg34XIntkre5EaT7yjjhI9pOD5Mw5k2X/DdUwFr3cQ7Pu23E/BiwXyWSOxrNqx+ewnsayam5OLBtbOGPUM/r93YZL4/dhpR/amwByGFBz170gNChA6w5bQQMqramBTgJ+Z3A58WuWejPCaHQAAAABJRU5ErkJggg=="; | |
static Texture2D Base64ToTexture (string base64) { | |
Texture2D t = new Texture2D (1, 1); | |
t.hideFlags = HideFlags.HideAndDontSave; | |
t.LoadImage (System.Convert.FromBase64String (base64)); | |
return t; | |
} |
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
[System.Serializable] | |
public class SimplePID { | |
public float Kp = 1f; | |
public float Ki = 0f; | |
public float Kd = .1f; | |
float _lastError; | |
float _p, _i, _d; | |
public void Reset() { |
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
[DllImport("USER32.dll")] | |
public static extern short GetKeyState(int keycode); | |
var capsLocked = (GetKeyState(0x14) & 1) > 0; |
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 class GrowList<T> { | |
public T[] Items; | |
public int Count; | |
public GrowList (int capacity) { | |
Items = new T[capacity]; | |
Count = 0; | |
} | |
public void Add (T item) { |
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.Diagnostics; | |
using System.Linq; | |
using System.Reflection; | |
using MessagePack; | |
using Mk.Routines; | |
using Unity.Collections; | |
using Unity.Networking.Transport; | |
using UnityEngine; |
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; | |
using UnityEngine; | |
using Random = UnityEngine.Random; | |
using Unity.Collections; | |
using Unity.Jobs; | |
[ExecuteAlways] | |
public class Avoidance : MonoBehaviour |
NewerOlder