using UnityEngine;
using System.Collections;

public class OwlCamera : MonoBehaviour {

	public float moveSpeed = 10.0f;
	public float margin = 10.0f;

	public void Awake() {
		transform.position = new Vector3(0, Data.owlHeight, 0);
	}

	// Update is called once per frame
	void Update () {
		float dt = Time.deltaTime;

		Vector2 mouseLoc = Input.mousePosition;

		Vector2 dir = Vector2.zero;
		if (mouseLoc.x < margin) {
			dir.x -= 1;
		}
		if (mouseLoc.x > Screen.width - margin) {
			dir.x += 1;
		}
		if (mouseLoc.y < margin) {
			dir.y -= 1;
		}
		if (mouseLoc.y > Screen.height - margin) {
			dir.y += 1;
		}

		// move the screen
		transform.position = new Vector3(transform.position.x + dir.x * moveSpeed, transform.position.y, transform.position.z + dir.y * moveSpeed);
	}
}
