Skip to content

Instantly share code, notes, and snippets.

Emil Johansen AngryAnt

Block or report user

Report or block AngryAnt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View RenderGUIToTexture.cs
using UnityEngine;
using System.Collections;
[RequireComponent (typeof (Renderer))]
public class RenderGUIToTexture : MonoBehaviour
{
public RenderTexture texture;
public Texture2D background;
View GameManager.cs
using UnityEngine;
using System.Collections;
public enum GameStatus
{
Setup,
Initializing,
ReInitializing,
AwaitingMasterServer,
View Player.cs
using UnityEngine;
using System.Collections;
[RequireComponent (typeof (NetworkView))]
[RequireComponent (typeof (Rigidbody))]
[RequireComponent (typeof (AnimationController))]
public class Player : MonoBehaviour, System.IComparable
{
public Transform graphicsPrefab;
View Connection.cs
public float GetCost (Agent agent)
{
return (To.Position - From.Position).Magnitude *
Weight *
(customWeightHandler == null ? 1.0f : customWeightHandler (agent, this));
}
@AngryAnt
AngryAnt / MyAgent.cs
Created May 30, 2011
Tree tick frequency.
View MyAgent.cs
using UnityEngine;
using System.Collections;
using Behave.Runtime;
using Tree = Behave.Runtime.Tree;
public class MyAgent : IAgent
{
private Tree myTree;
@AngryAnt
AngryAnt / ExplicitProperty.txt
Created May 30, 2011
Explicit property type
View ExplicitProperty.txt
// This:
public Rigidbody target;
void FixedUpdate ()
{
target.AddForce (transform.forward * 1.0f);
}
@AngryAnt
AngryAnt / MyStateMachine.cs
Created May 31, 2011
A simple state machine using a dictionary of delegates indexed by an enum.
View MyStateMachine.cs
using UnityEngine;
using System.Collections.Generic;
public class MyStateMachine : MonoBehaviour
{
public delegate void StateHandlerDelegate ();
public enum MyStateType
@AngryAnt
AngryAnt / DelayedInitialization.cs
Created Jun 6, 2011
An example of how to do delayed initialization - spreading heavy initialization workloads across multiple frames.
View DelayedInitialization.cs
private static int newID = 0;
private int id;
private bool initialized = false;
IEnumerator Start ()
{
id = newID++;
for (int i = 0; i < id; i++)
{
@AngryAnt
AngryAnt / build.pl
Created Jun 7, 2011
Example perl script for building .net assemblies for use in Unity.
View build.pl
#!/bin/usr/perl
use strict;
use File::Basename;
chdir (File::Spec->rel2abs (dirname($0)."/..")); # Modify for location of perl script
my $monoPath = "External/Mono/builds/monodistribution";
my @sourceDirs = (
"Path/To/Source/*.cs",
"Path/To/More/Source/*.cs"
@AngryAnt
AngryAnt / InteractionExample.cs
Created Jul 13, 2011
An example of how interaction could be done. Untested code.
View InteractionExample.cs
using UnityEngine;
public class InteractionExample : MonoBehaviour
{
public string interactionKey = "i";
public float interactionRadius = 2.0f, interactionViewCone = 60.0f;
void Update ()
You can’t perform that action at this time.