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.Events; | |
namespace WizBangify | |
{ | |
public delegate void Subscription(bool add); |
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
// CodeMirror, copyright (c) by Marijn Haverbeke and others | |
// Distributed under an MIT license: http://codemirror.net/LICENSE | |
(function (mod) { | |
if (typeof exports == "object" && typeof module == "object") // CommonJS | |
mod(require("../../lib/codemirror"), require("../yaml/yaml")) | |
else if (typeof define == "function" && define.amd) // AMD | |
define(["../../lib/codemirror", "../yaml/yaml"], mod) | |
else // Plain browser env | |
mod(CodeMirror) |
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; | |
/* | |
You could name this class GameEvents or whatever you want. I chose Announcments because | |
it doesn't conflict with any builtin Unity class names. I can just type 'ann' and my IDE's | |
auto-complete takes care of the rest. | |
*/ | |
public static class Announcements | |
{ | |
public static class Camera |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public static class AnimationTools | |
{ | |
public static IEnumerator AnimateRotation(Transform animationTarget, Vector3 rotateTo, AnimationCurve curve, float time) | |
{ | |
var timer = 0f; |
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; | |
/// <summary> | |
/// Be aware this will not prevent a non singleton constructor | |
/// such as `T myT = new T();` | |
/// To prevent that, add `protected T () {}` to your singleton class. | |
/// | |
/// As a note, this is made as MonoBehaviour because we need Coroutines. | |
/// </summary> | |
public class SingletonMonoBehaviour<T> : MonoBehaviour where T : MonoBehaviour |
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; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class FsmMonoBehaviour<TEnum> : MonoBehaviour where TEnum : struct, IConvertible, IComparable, IFormattable | |
{ | |
private class StateMethodCache | |
{ | |
public Action enterState; |
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; | |
public class CameraShake : MonoBehaviour | |
{ | |
public static CameraShake instance; | |
private Vector3 _originalPos; | |
private float _timeAtCurrentFrame; |
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
/** | |
* For use with React Components. Example usage: | |
* | |
* usernameInput = assignableRef<HTMLInputElement>(this) | |
* | |
* // In render... | |
* | |
* <input type="text" ref={this.usernameInput.assign} /> | |
* | |
* // In a handler somewhere... |
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
export function walkPath<T = any>(path: string[] | string): (source: any) => T | undefined { | |
const steps = Array.isArray(path) ? path : path.split('.') | |
return (source: any) => steps | |
.reduce((node, name) => (node && name in node ? node[name] : undefined), source) | |
} | |
export function runPath<T = any>(path: string[] | string): (source: any) => T { | |
const steps = Array.isArray(path) ? path : path.split('.') | |
return (source: any) => { |
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
class MyJsonAPI<T = any> { | |
key: string | |
constructor(key?: string) { | |
if (validKey(key)) { | |
this.key = key | |
} | |
} |