package  
{
	import net.flashpunk.Entity;	
	import net.flashpunk.FP;	
	/**
	 * ...
	 * @author AntoineGuerchais
	 */
	public class Year extends Entity
	{
		private var init:Boolean;
		private var season:Array;
		public var time:Number;
		
		public function Year() 
		{
			season = new Array();
			for (var i:int = 0; i < 4; ++i)
			{
				season[i] = new Season(i,this);
				//FP.world.add(season[i]);
			}
			time = 0.25*0.5;
			init = false;
		}
		
		override public function update():void 
		{
			
			if (!(FP.world as TreeWorld).paused)
			{
				if (!init)
				{
					for (var i:int = 0; i < 4; ++i)
					{
						FP.world.add(season[i]);
					}
					init = true;
				}
				
				time += FP.elapsed*0.01;
				//time += ((FP.world as TreeWorld).nbBranch / (FP.world as TreeWorld).maxBranch - time) * FP.elapsed*2;
				//FP.console.log("year:" + time);
			}
		}
	}

}