using UnityEngine;
using System.Collections;

public class GThinkie : Thinkie {
	
	private float angle;

	void Start(){
		type = ThinkieType.GOOD;
		angle = (Mathf.Atan (transform.position.y / transform.position.x) * Mathf.Rad2Deg) - 180.0f;
		if (transform.position.x < 0.0f) {
			transform.localScale = new Vector3 (-1.0f, 1.0f, 1.0f);
		}
		transform.eulerAngles = new Vector3 (transform.eulerAngles.x, transform.eulerAngles.y, angle);
	}

	public override void BulletHit (){
		if (!isGoingToExit ()) {
			Boom ();
		}
	}

	public override void IdeaQueueReaction (){
		Boom ();
	}

	public void TeleportToExit(){
		MakeInvisible();
		SetArrived(true);
		IdeaQueue iq = GameObject.FindGameObjectWithTag ("IdeaQueue").GetComponent<IdeaQueue>();
		iq.pushToQueue(this.GetComponent<Thinkie>());
	}
}
