Skip to content

Instantly share code, notes, and snippets.

View lonewolfwilliams's full-sized avatar

Gareth Williams lonewolfwilliams

View GitHub Profile
public interface ITuple //like a maybe
{
ITuple Add<T>(T item);
}
public class Tuple : ITuple //like a nothing
{
public ITuple Add<T>(T item)
{
return new Tuple<T>(item);
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Observable:MonoBehaviour
{
//stub...
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
// ____ ____ __ _
// / __/_ _____ ______ __/ __/_ __/ /____ ___ ___ (_)__ ___ ___
// / _// // / _ \/ __/ // / _/ \ \ / __/ -_) _ \(_-</ / _ \/ _ \(_-<
// /_/ \_,_/_//_/\__/\_, /___//_\_\\__/\__/_//_/___/_/\___/_//_/___/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using UnityEngine;
/**
* It works like this:
* Add a [LogGroup("groupname")] to every class you want to group
@lonewolfwilliams
lonewolfwilliams / cheatsheet.shader
Last active October 17, 2021 19:27
A cheatsheet and or boilerplate for CG / shaderlab in Unity
Shader "Unlit/ScreenFade"
{
Properties
{
//https://docs.unity3d.com/Manual/SL-Properties.html
//[HideInInspector]
//[NoScaleOffset]
//[Normal]
//[HDR]
//[Gamma]
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
using UnityEngine.UI;
//using Debug = NotUnityEngine.Debug;
Shader "Unlit/GBShader"
{
Properties
{
//to apply the filter to (could also be a rendertexture)
_MainTex ("Texture", 2D) = "white" {}
//a 256 x 256 'ramp' image with 4 shades of gray in (each 64 x 256)
_PalTex ("Pallete", 2D) = "white" {}
//a pow2 virtual resolution for the display
_Res ("Resolution", Float) = 64
@lonewolfwilliams
lonewolfwilliams / SteamController.cs
Created October 22, 2016 07:26
Simple, fluent, wrapper for SteamController in Unity3d (requires Steamworks.NET & valid app ID)
using UnityEngine;
using System.Collections;
using Steamworks;
using UnityEngine.UI;
using System.Collections.Generic;
using System;
/// <summary>
/// Gareth Williams - Lonewolfwilliams LTD
/// Wraps the Steamcontroller part of the Steamworks API in a simplified, fluent interface
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
/// <summary>
/// Gareth Williams - Lonewolfwilliams LTD
/// http://lww.io
/// </summary>
public class Promises : MonoBehaviour
@lonewolfwilliams
lonewolfwilliams / Promises.cs
Last active October 1, 2016 13:46
Simple, monadic, promises for Unity
using UnityEngine;
using System.Collections;
using System;
/// <summary>
/// Gareth Williams - Lonewolfwilliams LTD
/// http://lww.io
/// </summary>
public class Promises : MonoBehaviour
{