Skip to content

Instantly share code, notes, and snippets.

View bzgeb's full-sized avatar

Bronson Zgeb bzgeb

View GitHub Profile
app.configure(function () {
app.use(express.static(__dirname + '/public'));
app.use(express.bodyParser());
app.set('views', __dirname);
//app.set('view engine', 'jade');
// make a custom html template
app.register('.html', {
compile: function(str, options){
return function(locals){
return str;
@bzgeb
bzgeb / SetSortingLayer.cs
Created February 20, 2014 19:23
Set sorting layer component. Sets the sorting layer and order of any renderer, not just sprite renderers.
using UnityEngine;
using System.Collections;
public class SetSortingLayer : MonoBehaviour
{
public string sortingLayerName;
public int sortingLayerOrder;
void Start() {
renderer.sortingLayerName = sortingLayerName;
@bzgeb
bzgeb / Glitch.shader
Created February 12, 2014 22:00
Plaid World
Shader "Custom/Glitch" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
@bzgeb
bzgeb / Makefile
Created December 20, 2013 19:17
How to astyle
#Usage I=infile make style
style:
astyle -c -j --style=google -f -p --unpad-paren -H -D -S $(I)
@bzgeb
bzgeb / Makefile
Created December 20, 2013 18:22
Texturepacker makefile
#Usage I=infile O=outfile make sheet
sheet:
Texturepacker --format unity --data $(O){v}.txt --sheet $(O){v}.png --variant 1:@2x --force-identical-layout --variant 0.5:@1x --max-width 4096 --max-height 4096 --size-constraints POT --algorithm Basic --basic-order Ascending --basic-sort-by Name --pack-mode Best --border-padding 2 --shape-padding 2 --disable-rotation $(I)
@bzgeb
bzgeb / BendingTrees.cginc
Last active April 6, 2019 18:50
This is how trees and grass bend
fixed4 TerrainWaveGrass (inout float4 vertex, float waveAmount, fixed4 color)
{
float4 _waveXSize = float4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y;
float4 _waveZSize = float4 (0.006, .02, 0.02, 0.05) * _WaveAndDistance.y;
float4 waveSpeed = float4 (0.3, .5, .4, 1.2) * 4;
float4 _waveXmove = float4(0.012, 0.02, -0.06, 0.048) * 2;
float4 _waveZmove = float4 (0.006, .02, -0.02, 0.1);
float4 waves;
@bzgeb
bzgeb / ScreenshotController.cs
Created October 2, 2013 19:19
Unity Screenshot Controller Thing
using UnityEngine;
using System.Collections;
public class ScreenshotController : MonoBehaviour
{
void Update() {
if ( Input.GetKeyDown( KeyCode.Alpha1 ) ) {
Application.CaptureScreenshot( "ScreenshotSize1.png", 1 );
}
if ( Input.GetKeyDown( KeyCode.Alpha2 ) ) {
@bzgeb
bzgeb / PlayerPrefsSerializer.cs
Created September 27, 2013 19:27
Player Prefs Serializer
/**
* @file PlayerPrefsSerializer.cs
* @brief Code snippet from UnityForum (http://forum.unity3d.com/threads/72156-C-Serialization-PlayerPrefs-mystery)
* @author mindlube+FizixMan
* @version 1.0
* @date 2012-06-15
*/
using UnityEngine;
using System;
@bzgeb
bzgeb / PlatformMonitor.cs
Created August 12, 2013 22:54
Example Platform Monitoring script
using UnityEngine;
using UnityEditor;
using System.Collections;
[InitializeOnLoad]
public class PlatformMonitor {
static BuildTarget cachedPlatform;
static PlatformMonitor() {
cachedPlatform = EditorUserBuildSettings.activeBuildTarget;
@bzgeb
bzgeb / gitignore
Created June 18, 2013 17:07
My Unity gitignore File
Library/*
Temp/*
*.booproj
*.csproj
*.sln
*.userprefs
*.pidb
*.unityproj
.DS_Store