using UnityEngine;
using System.Collections;

public class HoardBoxControl : MonoBehaviour {

	#region Private Variables
	private Vector3 _targetRotation;
	private float _duration = 5f;
	private float _startTime;
	#endregion


	#region Events
	void Update () {

		float t = (Time.time - _startTime) / _duration;
		transform.rotation = Quaternion.Lerp (transform.rotation, Quaternion.Euler (_targetRotation), t);

	}


	void OnMouseDown () {

		_targetRotation.z += 90f;
		_startTime = Time.time;

	}
	#endregion

}
