Skip to content

Instantly share code, notes, and snippets.

View Bradshaw's full-sized avatar
🚀
Lost in space

Gaeel Bradshaw-Rodriguez Bradshaw

🚀
Lost in space
View GitHub Profile
@Bradshaw
Bradshaw / pictoselect.cs
Created March 6, 2019 14:17
🤷‍♀️
string PrintMe(){
Dictionary<string,string> pictos = new Dictionary<string,string>();
pictos.Add("ur", "└");
pictos.Add("ulr", "┴");
pictos.Add("dlr", "┬");
pictos.Add("udr", "├");
pictos.Add("lr", "─");
pictos.Add("udlr", "┼");
pictos.Add("dr", "┌");
pictos.Add("dl", "┐");
@Bradshaw
Bradshaw / PulseOnBeat.cs
Last active January 29, 2019 10:12
Simple beat follower script demo
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class PulseOnBeat : MonoBehaviour {
public float minScale;
public float maxScale;
@Bradshaw
Bradshaw / better_sin.js
Created June 28, 2017 08:47
Better version of Math.sin for javascript
var old_sin = Math.sin;
Math.sin = function(x) {
if (typeof x == "number" && isFinite(x)){
return old_sin(x);
}
var str = "" + x;
if (str.length>0){
str = str.repeat(Math.ceil(Math.max(1,18/str.length)));
}
var sinstr = "|\n";
@Bradshaw
Bradshaw / horriblesort.lua
Created November 20, 2018 15:58
Horrible Sort in Lua
-- Creates a table containing the values 1 through num
function tableOf(num)
local t = {}
for i=1,num do
t[i] = i
end
return t
end
-- Shuffles a table
@Bradshaw
Bradshaw / Walkabout.cs
Created November 12, 2018 16:58
BG1-A
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Walkabout : MonoBehaviour {
public float acceleration = 1;
public float friction;
public float radius;
Vector3 velocity;
@Bradshaw
Bradshaw / Blob.shader
Last active November 16, 2018 16:03
Unity move vertex shader thing
Shader "Custom/Blob" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_PushTex ("Thing", 2D) = "white" {}
_Push ("Push", Range(-1,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FPS : MonoBehaviour {
Text text;
float smootheddt = 1 / 60;
float smoothvel;
List<float> last100;
@Bradshaw
Bradshaw / StretchProject.cs
Created October 30, 2018 14:36
Use this with a Unity camera set to orthographic projection in an oblique top-down view
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StretchProject : MonoBehaviour {
public Matrix4x4 originalProjection;
Camera cam;
[Range(1,2)]
public float stretch = 1;
@Bradshaw
Bradshaw / Brainput.cs
Last active July 19, 2018 08:47
Just let met poll the joysticks plz Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class Brainput{
public static float GetAxis(int controller, int axis){
return Input.GetAxis("joystick " + controller + " analog " + axis);
}
public static bool GetButton(int controller, int button){
@Bradshaw
Bradshaw / AimTracker.cs
Created July 18, 2018 17:26
Little delegate example
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// This is what our events look like
public delegate void AimTrackerEvent(Vector3 point, int playerNumber);
public class AimTracker : MonoBehaviour {
// These are all the events