Skip to content

Instantly share code, notes, and snippets.

View adampassey's full-sized avatar
:shipit:
Building and playing 🎮

Adam Passey adampassey

:shipit:
Building and playing 🎮
View GitHub Profile
@adampassey
adampassey / JSONMapParser.cs
Last active August 29, 2015 14:12
Threw together a quick example of loader from Tiled to Unity that allows for parsing flexibility.
using SimpleJSON;
class JSONMapParser : MapParser {
public Map Parse(string text) {
Map map = new Map();
JSONNode json = JSON.Parse(text);
map.Name = json["name"];
//... populate map
@adampassey
adampassey / Singleton.cs
Created July 24, 2014 05:43
Unity Singleton Pattern with MonoBehaviour Objects
public class Singleton : MonoBehaviour {
private static Singleton instance;
/**
* Retrieve the instance
**/
public static Singleton GetInstance() {
if (instance == null) {
GameObject go = new GameObject();
@adampassey
adampassey / Apple.js
Created July 15, 2014 02:28
Polymorphism in Unity with Javascript
#pragma strict
public class Apple extends Fruit {
public function Start() {
identifier = "An apple.";
}
}
@adampassey
adampassey / Apple.cs
Created July 13, 2014 22:37
Polymorphism in Unity with C#
using UnityEngine;
using System.Collections;
public class Apple : Fruit
{
public void Start() {
weight = 0.5f;
}
}