package  
{
		import net.flashpunk.FP;	
	import net.flashpunk.Entity;
	import net.flashpunk.utils.Draw;
	import net.flashpunk.graphics.Image;
		import net.flashpunk.Mask;
	import net.flashpunk.masks.Pixelmask;
	/**
	 * ...
	 * @author AntoineGuerchais
	 */

	
	public class Light extends Entity
	{
		
		public  var light:Image;
		public var branchInLight:int=0;
		public function Light() 
		{
		}
		
		override public function update():void
		{
			var branchList:Array = [];
		    FP.world.getClass(Branch, branchList);
			branchInLight = 0;
			for each (var e:Branch in branchList) {
				if (mask.collide(e.mask) && e.childs.length == 0) {
					branchInLight++;
					e.inLight = true;
				}
				else
				{
					e.inLight = false;
				}
			}
			//FP.console.log("NB branch in light" + branchInLight);
		}
		
		override public function render():void {
			
			super.render();
		}
		
	}

}