
using System;
using Math2D;
using Math2D.Shapes;

namespace PlanetExpress.items.enemys.masters
{
	
	
	public class CamicadzeEnemyMaster : BaseEnemyMaster
	{
		
		Vector2D Target = new Vector2D();
		static Random rnd = new Random();
		float tick;
		public CamicadzeEnemyMaster(EnemyClass enemy) : base(enemy) {
			tick = GetHashCode()/10000f;
			NewTarget();
		}
		
		void NewTarget() {
			Target = new Vector2D(
			                      MissionScreenClass.Area.Player.X,
			                      MissionScreenClass.Area.Player.Y);
		}
		
		public override void Action (double timer) {
			tick += 10f * (float)timer;
			if ((((int)tick) % 15) == 0) {
				NewTarget();
				Enemy.Shoot();
			}
			
			Vector2D Va = new Vector2D(Enemy.X, Enemy.Y) - Target;
			
			
			Va.Length = 100f * Enemy.SpeedScale * (float)timer;
			if (Enemy.Fixed) Enemy.X -= Va.X;
			Enemy.Y -= Va.Y;
		}
	}
}
