package  {
	import adobe.utils.CustomActions;
	import com.bit101.components.HBox;
	import com.bit101.components.HSlider;
	import com.bit101.components.InputSlider;
	import com.bit101.components.InputSlidernew;
	import com.bit101.components.Slider;
	import com.bit101.components.VBox;
	import com.netgrind.core.Scheduler;
	import com.netgrind.core.Utils;
	import flash.display.Sprite;
	import flash.geom.Point;
	import nape.geom.Vec2;
	/**
	 * ...
	 * @author netgrind
	 */
	public class HUDTarget extends Sprite{
		
		public var points:Vector.<Vec2> = new Vector.<Vec2>();
		public var colors:Vector.<Number> = new Vector.<Number>();
		public var center:Vec2 = new Vec2(350, 250);
		
		public function HUDTarget() {
			Scheduler.invokeEvery(update);
		}
		
		public function addPoint(point:Vec2, color:uint = 0xcc6633):void {
			if (points.indexOf(point) != -1) return;
			points.push(point);
			colors.push(color);
		}
		public function removePoint(point:Vec2):void {
			var i:int = points.indexOf(point);
			if (i == -1) return;
			points.splice(i, 1);
			colors.splice(i, 1);
		}
		
		public var min:Number = .5;
		public var max:Number = .1;
		public var ringWidth:Number = 20;
		public var scale:Number = .001;
		public var size:Number = 200;
		
		public function update():void {
			graphics.clear();
			for (var i:int = 0; i < points.length; i ++) {
				var n:Number = i / points.length;
				var a:Number = Math.atan2(points[i].y - center.y, points[i].x - center.x);
				var d:Number = Utils.getDistance(center, points[i]);
				d = Math.min(120, d);
				graphics.beginFill(colors[i]);
				graphics.drawCircle(Math.cos(a)*d, Math.sin(a)*d, 10);
				graphics.endFill();
				/*graphics.beginFill(colors[i]);
				var a:Number = Math.atan2(points[i].y - center.y, points[i].x - center.x);
				var d:Number = (1-n)*1.5+n*1.5;
				graphics.moveTo(Math.cos(a - d)*r , Math.sin(a - d)*r );
				graphics.lineTo(Math.cos(a) * (r + ringWidth), Math.sin(a) * (r + ringWidth));
				graphics.lineTo(Math.cos(a + d)*r , Math.sin(a + d)*r );
				graphics.endFill();*/
			}
			
		}
		
	}

}