#pragma strict
//Scripts written in Javascript can subscribe to
//events made in C#. The key is that the C# scripts
//must be compiled before the Javascripts. In the are
//compiled at the same time, they won't be able to
//"see" each other.
function OnEnable()
{
EventManager.OnClicked += Teleport;
}
function OnDisable()
{
EventManager.OnClicked -= Teleport;
}
function Teleport()
{
var pos : Vector3 = transform.position;
pos.y = Random.Range(1.0f, 3.0f);
transform.position = pos;
}

#pragma strict
//Scripts written in Javascript can subscribe to
//events made in C#. The key is that the C# scripts
//must be compiled before the Javascripts. In the are
//compiled at the same time, they won't be able to
//"see" each other.
function OnEnable()
{
EventManager.OnClicked += TurnColor;
}
function OnDisable()
{
EventManager.OnClicked -= TurnColor;
}
function TurnColor()
{
var col : Color = new Color(Random.value, Random.value, Random.value);
renderer.material.color = col;
}