All pastes #2097047 Raw Edit

Someone

public text v1 · immutable
#2097047 ·published 2011-12-28 18:24 UTC
rendered paste body
public class Arrow : MonoBehaviour {
	public int player = 0;
	
	void Start(){
		Messenger<int>.AddListener("Destroy Self", destroySelf);	
	}
	
	void OnMouseDown(){
		Debug.Log("Arrow clicked - "+player);
		//Turn cam movement back on.
		GameObject.Find("EditorCamera").GetComponent<TopDownCamera>().moveable = true;
		
		//Send message that arrow has been clicked to the level editor (startpoint spawner)
		Messenger<string>.Broadcast("SetStartSide", gameObject.name +" "+player);
		
		//send to all arrows.
		Messenger<int>.Broadcast("Destroy Self", 0);
	}
	
	void destroySelf(int i){
		Destroy(gameObject);
	}
	
	void OnDestroy(){
		Messenger<int>.RemoveListener("Destroy Self", destroySelf);
		Destroy(gameObject);
	}
}