Skip to content

Instantly share code, notes, and snippets.

Emil Johansen AngryAnt

View GitHub Profile
View Jerboa.swift
//
// main.swift
// Jerboa
//
// Created by Emil Johansen on 19/01/2019.
// Copyright © 2019 AngryAnt. All rights reserved.
//
// https://en.wikipedia.org/wiki/Jerboa
//
@AngryAnt
AngryAnt / Drawer.cs
Last active Aug 6, 2017
Attempting to override the default UnityEvent drawer.
View Drawer.cs
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine.Events;
using System.Reflection;
namespace Test
{
[CustomPropertyDrawer (typeof (UnityEventBase), true)]
View CoreCharacterInstance.cs
using UnityEngine;
public class CoreCharacterInstance : MonoBehaviour
{
[SerializeField] CoreCharacter m_CoreCharacter;
[SerializeField] Character m_Character;
void Reset ()
View keybase.md

Keybase proof

I hereby claim:

  • I am angryant on github.
  • I am angryant (https://keybase.io/angryant) on keybase.
  • I have a public key ASD8ySmPVOXxJ6-08vcEIoK2yFrxwh6eUfa6DgVY6EuKSwo

To claim this, I am signing this object:

@AngryAnt
AngryAnt / MoveComponentContext.cs
Last active Jul 5, 2017
Adds "Move to Top" and "Move to Bottom" items to the inspector context menu of components.
View MoveComponentContext.cs
using UnityEngine;
using UnityEditor;
public class MoveComponentContext
{
enum Destination
{
Top,
Bottom
@AngryAnt
AngryAnt / BehaveExtensions.cs
Last active Aug 29, 2015
Tree.ReflectClassForwards (GameObject) and Tree.SetForwards (int id, IActionClass actionClass). This is now built-in per Behave 2.6.
View BehaveExtensions.cs
using UnityEngine;
using Behave.Runtime;
using Library = BLYourLibraryName;
using Tree = Behave.Runtime.Tree;
public interface IActionClass
{
bool OnForward (Tree sender);
BehaveResult Init (Tree sender);
View Levels.cs
const int
kPreLevelScenes = 2, // Number of scenes before the first level (splash, menu, etc.)
kPostLevelScenes = 0; // Number of scenes after last level (score, credits, whatever)
const string kLevelScorePrefix = "Score for level ";
// ...
void OnLevelBeat ()
{
if (Application.loadedLevel < Application.levelCount - kPostLevelScenes - 1)
View CoroutineData.cs
//#define DEBUG_THREADING
using UnityEngine;
using System.Collections;
using System.Threading;
using System.Reflection;
public delegate IEnumerator MonitorCoroutine<T> (CoroutineData<T> data);
@AngryAnt
AngryAnt / DependencyInstall.cs
Last active Dec 30, 2015
A quick example demonstrating how unpacking logic for an asset store package could be set up to be contingent on the presence of a specific code dependency.
View DependencyInstall.cs
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies ())
{
string location = Path.GetDirectoryName (assembly.CodeBase).Replace (Path.DirectorySeparatorChar, '/');
if (location.StartsWith ("file:"))
{
location = location.Substring ("file:".Length);
}
if (!location.BeginsWith (Application.dataPath.Substring (0, Application.dataPath.Length - "Assets".Length)))
@AngryAnt
AngryAnt / gist:7080116
Created Oct 21, 2013
Silly workaround for easy alpha scaling on the Unity Color type.
View gist:7080116
public static Color A (this Color color, float alphaScale)
{
return new Color (color.r, color.g, color.b, color.a * alphaScale);
}
// Gizmos.color = Color.red.A (0.3f);
You can’t perform that action at this time.