Skip to content

Instantly share code, notes, and snippets.

View aberloni's full-sized avatar
💅

André Berlemont aberloni

💅
View GitHub Profile
@aberloni
aberloni / AS3 delta time
Last active August 29, 2015 14:18
Flash AS3 simple delta time
package
{
import flash.display.Stage;
import flash.events.Event;
import flash.utils.getTimer;
/**
* ...
* @author ...
*/
public class Time
@aberloni
aberloni / Haxeflixel BMPFile to FlxSprite
Last active August 29, 2015 14:19
A haxeflixel class to transform a bitmap file on the user harddrive (absolute path) to FlxSprite
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxGroup;
import flixel.util.FlxColor;
import flash.display.BitmapData;
/**
* ...
* @author a.berlemont
@aberloni
aberloni / UNITY GameTime.cs
Last active August 29, 2015 14:19
Script to have a deltatime and timescale independent to Time.deltaTime in Unity
using UnityEngine;
using System.Collections;
public class GameTime : MonoBehaviour {
public static GameTime manager;
public float timeScale = 1;
float elapsedTime;
public static float deltaTime;
@aberloni
aberloni / FbxImporter
Last active August 29, 2015 14:20
Auto setup import fbx settings
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
public class FbxImporter : AssetPostprocessor {
void OnPreprocessModel() {
ModelImporter model = (ModelImporter)assetImporter;
model.addCollider = true;// This tells it to add a collider to the object
@aberloni
aberloni / FpsWarning.cs
Last active August 29, 2015 14:20
Tool to warn if fps is under a given value
using UnityEngine;
using System.Collections;
public class FpsWarning : MonoBehaviour {
int fps = 0;
public int monitorValue = 60;
GUIStyle style;
void OnGUI(){
@aberloni
aberloni / SystemIOTools.cs
Created May 7, 2015 13:26
System IO tools
using System.IO;
public class SystemIOTools {
//https://msdn.microsoft.com/en-us/library/vstudio/cc148994%28v=vs.100%29.aspx
static public void copyFolderToFolder(string sourcePath, string targetPath){
if (!System.IO.Directory.Exists(targetPath))
{
System.IO.Directory.CreateDirectory(targetPath);
@aberloni
aberloni / EasingCurves
Created May 7, 2015 14:18
all iTween easing curves math equations
#region Easing Curves
private float linear(float start, float end, float value){
return Mathf.Lerp(start, end, value);
}
private float clerp(float start, float end, float value){
float min = 0.0f;
float max = 360.0f;
@aberloni
aberloni / UnityTools
Last active September 29, 2015 08:13
A series of useful statics functions to work in Unity
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class UnityTools {
static public Transform fetchInChildren(Transform parent, string partName){
foreach(Transform t in parent){
if(t.name.IndexOf(partName) > -1) return t;
Transform child = fetchInChildren(t, partName);
@aberloni
aberloni / MouseCrosshair.cs
Last active November 10, 2016 13:45
Unity crosshair
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MouseCrosshair : MonoBehaviour {
protected int cursorState = 0; // index of states[] to draw on screen
protected int cursorSizeX = 16;
protected int cursorSizeY = 16;
@aberloni
aberloni / ProgressiveLookAt.cs
Created May 26, 2015 14:44
UNITY - Transform will progressively look at another transform
using UnityEngine;
using System.Collections;
public class ProgressiveLookAt : MonoBehaviour
{
Transform _origin; // itself
//LOOK AT
public float lookSpeed = 1f; // with target ref
public Transform target;