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);
}
}