//--------------------------------------
//               PowerUI
//
//        For documentation or 
//    if you have any issues, visit
//        powerUI.kulestar.com
//
//    Copyright  2013 Kulestar Ltd
//          www.kulestar.com
//--------------------------------------

using System;
using UnityEngine;


namespace Css.Units{
	
	/// <summary>
	/// Represents an instance of a gradians angle.
	/// </summary>
	
	public class GradiansUnit:AngleUnit{
		
		public override float DisplayNumber{
			get{
				return ( RawValue / (Mathf.PI * 2f/400f) );
			}
		}
		
		public override string ToString(){
			return DisplayNumber+"grad";
		}
		
		public override void OnValueReady(CssLexer lexer){
			// Map to radians:
			RawValue *= Mathf.PI * 2f/400f;
		}
		
		protected override Value Clone(){
			GradiansUnit result=new GradiansUnit();
			result.RawValue=RawValue;
			return result;
		}
		
		public override string[] PostText{
			get{
				return new string[]{"grad"};
			}
		}
		
	}
	
}



