using UnityEngine;
using System.Collections;

public class RotatePill : Pill {

	private float rotateTime = 2.0f;
	private float timeLeft;

	private float angleChange;

	private Camera camera;

	public override void attach(World world, Camera camera, Owl owl) {
		timeLeft = rotateTime;
		this.camera = camera;
		angleChange = Random.Range (200.0f, 300.0f) * Mathf.Sign (Random.Range (-1.0f, 1.0f));
	}
	
	public override void update(float dt, float totalTimeLeft) {
		if (timeLeft <= 0.0f) return;
		camera.transform.RotateAround(camera.transform.position, Vector3.up, angleChange * dt);
		timeLeft -= dt;
	}
	
	public override Color getColor() {
		return Color.red;
	}
}
