Skip to content

Instantly share code, notes, and snippets.

View keiranlovett's full-sized avatar

K keiranlovett

View GitHub Profile
@keiranlovett
keiranlovett / wkwstatus
Created June 18, 2014 12:05
Scrolling GUI Status (Who Killed Who)
import System.Collections.Generic;
import System.Linq;
import System;
class Message
{
//Holds the messages being displayed
static var messages : List.<Message> = new List.<Message>();
//Holds the messages waiting for display
static var queue : List.<Message> = new List.<Message>();
@keiranlovett
keiranlovett / recorder.cs
Created April 26, 2014 19:09
Unity: Recorder
using UnityEngine;
using UnityEditor;
public class Recorder : EditorWindow {
string myString = "FileNameHere";
string status = "Idle";
string recordButton = "Record";
int state = 0;
int fps = 24;
int[] fpsOptions = new int[] {12,24,30,60};
<canvas id="stage"></canvas>
@keiranlovett
keiranlovett / icebergShader
Created February 23, 2014 17:16
unity: iceberg shader
Shader "JaaVuori Gradiend Bumped" {
// JaaVuori is Iceberg in finnish
//
// I use finnish in variable, class etc names, maybe bad habit but it helps me to find my "own" code and stuff faster.
//
@keiranlovett
keiranlovett / Base_Texture
Created February 6, 2014 03:38
Unreal Engine 4's Physically Based Shader Model
Shader "Base_Texture"
{
Properties
{
_DiffuseAmount ( "Diffuse Amount", Range( 0.0, 1.0 ) ) = 0.25
_TexAmount ( "Texture Amount", Range( 0.0, 1.0 ) ) = 0.25
_SpecAmount ( "Specular Amount", Range( 0.0, 16.0 ) ) = 1.0
_SpecTexAmount ( "Spec Texture Amount", Range( 0.0, 1.0 ) ) = 0.25
_Diffusemap ( "Diffusemap", 2D ) = "diffuse" {}
@keiranlovett
keiranlovett / Base_Artifact
Created February 6, 2014 03:37
Texture-Sampled Vertex Distortion
Shader "Base_Artifact"
{
Properties
{
_DataTex ( "Data Artifact", 2D ) = "black" {}
_Rate ( "Artifact Rate", float ) = 2.0
_Screeny_rate ( "Screen Rate", float ) = 6.0
_WarpScale ( "Warp Scale", range( -2, 2 ) ) = 0.5
_WarpOffset ( "Warp Offset", range( 0, 0.5 ) ) = 0.5
@keiranlovett
keiranlovett / Vignetting
Created February 6, 2014 03:34
Vignetting Shader
Shader "Hidden/Vignetting" {
Properties {
_MainTex ("Base", 2D) = "white" {}
_VignetteTex ("Vignette", 2D) = "white" {}
_GlitchTex ("Glitch", 2D) = "white" {}
}
CGINCLUDE
#pragma target 3.0
// C# built-in event system used in Unity3D
//
// Author: Bartek Drozdz
// Reference: http://www.everyday3d.com/blog/index.php/2010/10/04/c-events-and-unity3d/
using UnityEngine;
public class EventDispatcher : MonoBehaviour
{
public delegate void EventHandler(GameObject e);
using UnityEngine;
using UnityEditor;
[CustomEditor (typeof(Trigger))]
[CanEditMultipleObjects()]
public class TriggerEditor : Editor
{
private SerializedObject obj;
private SerializedProperty radius;
using UnityEngine;
using System.Collections;
public class MoveTransform : IActivated {
public Transform objectMoved;
public Movements activatedPos, deactivatedPos;
[System.Serializable]
public class Movements {