Smooth rotation of cube on mouse click with no interruption, improve?

Hi all, I’m learning Unity and working on a simple tile/cube clicking game. I’d like a smooth 180 degree rotation upon clicking a cube. I also don’t want the player to be able to initiate another rotation while one is in progress. I cobbled together a script from some pieces I found but it looks kind of clunky. Does anyone see some places for improvement? I’m not sure if checking the angle difference constantly to tell when the rotation is done is the best way to do this. Any suggestions welcome. Code below,

public class TileController : MonoBehaviour {

	public float rotTime = 0.1f;
	public float rotationMargin = 0.01f;

	private Vector3 targetAngle;
	private bool isRotating = false;
	private float angleDiff;

	void OnMouseDown()
	{
		// set a new target angle if we are not rotating 
		if (!isRotating) {
			targetAngle = new Vector3 (
				transform.eulerAngles.x, 
				transform.eulerAngles.y + 180.0f, 
				transform.eulerAngles.z);
			isRotating = true;
		}	
	}


	// Update is called once per frame
	void Update () {
		
		if (isRotating) {
			float yVelocity = 0.0f;
			float yAngle = Mathf.SmoothDampAngle (
				               transform.eulerAngles.y, 
				               targetAngle.y,
				               ref yVelocity,
				               rotTime);
			
			transform.eulerAngles = new Vector3 (
				transform.eulerAngles.x,
				yAngle,
				transform.eulerAngles.z);
			
			angleDiff = Mathf.Abs( Mathf.DeltaAngle (yAngle, targetAngle.y));
			isRotating = angleDiff > rotationMargin;
		} 
			
	}
}

I modified the script in this post (Using Vector3.Lerp() correctly in Unity — One Man's Trash is Another Man's Blog) to achieve the rotation I was after …

public class SlerpRot : MonoBehaviour {

	/// The time taken to complete transform
	public float timeTakenDuringSlerp = 1f;

	// The angle to rotate through in degrees
	public float angularChange = 180;

	// Whether we are currently interpolating or not
	private bool _isSlerping;

	//The start and finish Quaternions for the interpolation
	private Quaternion _startPosition;
	private Quaternion _endPosition;
	private Vector3 _tmpEuler;

	//The Time.time value when we started the interpolation
	private float _timeStartedSlerping;


	// Called to begin the linear interpolation
	void StartSlerping()
	{
		_isSlerping = true;
		_timeStartedSlerping = Time.time;

		//We set the start position to the current rotation, and the finish to angularChange around the y-axis
		_startPosition = transform.rotation;
		_tmpEuler = new Vector3(
			_startPosition.eulerAngles.x,
			_startPosition.eulerAngles.y + angularChange,
			_startPosition.eulerAngles.z);
		_endPosition = Quaternion.Euler (_tmpEuler);
	}

	void OnMouseDown()
	{
		if (!_isSlerping) {
			StartSlerping ();
		}
	}


	//We do the actual interpolation in FixedUpdate()
	void FixedUpdate()
	{
		if(_isSlerping)
		{
			//We want percentage = 0.0 when Time.time = _timeStartedSlerping
			//and percentage = 1.0 when Time.time = _timeStartedSlerping + timeTakenDuringSlerp
			//In other words, we want to know what percentage of "timeTakenDuringSlerp" the value
			//"Time.time - _timeStartedSlerping" is.
			float timeSinceStarted = Time.time - _timeStartedSlerping;
			float percentageComplete = timeSinceStarted / timeTakenDuringSlerp;

			//Perform the actual slerping.  Notice that the first two parameters will always be the same
			//throughout a single slerp-processs (ie. they won't change until we click the mouse again
			//to start another slerp)
			transform.rotation = Quaternion.Slerp (_startPosition, _endPosition, percentageComplete);

			//When we've completed the slerp, we set _isSlerping to false
			if(percentageComplete >= 1.0f)
			{
				_isSlerping = false;
			}
		}
	}

}