Skip to content

Instantly share code, notes, and snippets.

@keiranlovett
keiranlovett / Easing.cs
Created June 14, 2017 02:37 — forked from Fonserbc/Easing.cs
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
*/
public class Easing
{
public static float Linear (float k) {
@keiranlovett
keiranlovett / git-feature-workflow.md
Created June 14, 2017 02:15 — forked from blackfalcon/git-feature-workflow.md
Git basics - a general workflow

There are many Git workflows out there, I heavily suggest also reading the atlassian.com [Git Workflow][article] article as there is more detail then presented here.

The two prevailing workflows are [Gitflow][gitflow] and [feature branches][feature]. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited.

When using Bash in the command line, it leaves a bit to be desired when it comes to awareness of state. I would suggest following these instructions on [setting up GIT Bash autocompletion][git-auto].

Basic branching

When working with a centralized workflow the concepts are simple, master represented the official history and is always deployable. With each now scope of work, aka feature, the developer is to create a new branch. For clarity, make sure to use descriptive names like transaction-fail-message or github-oauth for your branches.

@keiranlovett
keiranlovett / UIFadeAway.cs
Created June 13, 2017 03:00
UIBehaviorKit by slonermike
/************************************************************
*
* UI Fade Away
* 2016 Slonersoft Games
*
* Place this on a MaskableGraphic such as Image or Text and
* call Fade to make it fade away and grow.
*
* NOTE: Growth will happen relative to the pivot point of the
* element. This means if your pivot is on the top left, it
@keiranlovett
keiranlovett / SimpleUnityAds.cs
Last active May 29, 2017 10:09
Simple Unity Ads Integration with Callbacks
using UnityEngine;
using UnityEngine.Advertisements;
public class UnityAds : MonoBehaviour
{
private static UnityAds _instance;
public static UnityAds Instance
{
get
@keiranlovett
keiranlovett / WaveSpawner.cs
Created April 7, 2017 02:01
Simple spawning script with waves / timers
using UnityEngine;
using UnityEngine.Events;
using System.Collections;
public class WaveSpawner : MonoBehaviour {
public enum SpawnState { SPAWNING, WAITING, COUNTING };
[System.Serializable]
public class Wave
@keiranlovett
keiranlovett / cheatsheet.md
Created February 13, 2016 15:02
FFMPEG Cheatsheet

Reduce a mp4 video to half size

fmpeg -ss 30 -i video-2015.mp4 -vf scale='iw/2':-1 -c:v libx264 -c:a libfdk_aac video-2015-opt.mp4

Convert mp4 to webm

`ffmpeg -i video.mp4 -c:v libvpx -b:v 1M -c:a libvorbis video.webm``

Convert mp4 to ogg

@keiranlovett
keiranlovett / TriggerVolume.cs
Created January 19, 2016 08:24 — forked from brunomikoski/TriggerVolume.cs
General trigger for detecting collisions
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent(typeof(Collider))]
/// <summary>
/// General purpose trigger volume system
///
/// </summary>
/// <author>Bruno Mikoski</author>
/// <summary>
/// Returns a position on the edge of the screen
/// </summary>
/// <param name="horizontal">0 being left, and 1 being right</param>
/// <param name="vertical">0 being botton, and 1 being top of the screen</param>
/// <param name="horizontalPadding">Padding from the screen, 0 means on screen, and 0.1 will be 10% off the screen</param>
/// <param name="verticalPadding"> </param>
/// <returns></returns>
public Vector3 GetOffScreenPosition(float horizontal,
float vertical,
@keiranlovett
keiranlovett / DiffuseOverlay.shader
Created January 19, 2016 08:21 — forked from brunomikoski/DiffuseOverlay.shader
Overlay difuse shader (Object Above Everything else)
Shader "Custom/DiffuseOverlay" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
// Tags {"RenderType"="Opaque"} // original
Tags {"Queue" = "Overlay" "RenderType"="Opaque"} // modified
ZTest Always // this line is added
LOD 200
@keiranlovett
keiranlovett / StopPlayingOnRecompile.cs
Created January 19, 2016 08:05 — forked from zapdot/StopPlayingOnRecompile.cs
Stop Playing on Recompile
using UnityEditor;
[InitializeOnLoad]
public class StopPlayingOnRecompile
{
static StopPlayingOnRecompile()
{
EditorApplication.update = () =>
{
if (EditorApplication.isCompiling && EditorApplication.isPlaying)