using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using ShootingHero.Scene;
using Microsoft.Xna.Framework.Graphics;

namespace ShootingHero.Components.Bullets.BossBullet
{
	public class KomodoBullet : MonsterBullet
	{
		Texture2D texture;

		Timer timer;
		bool isFollowMode = true;

		public KomodoBullet ( Game game, float x, float y )
			: base ( game, x, y, 0, 2 )
		{
			if ( texture == null || texture.IsDisposed )
				texture = Game.Content.Load<Texture2D> ( "Bullet/bullet_komodo" );
			Texture = texture;
			Player player = ( ( Game.Components [ 0 ] as Transitor ).CurrentScene as GameScene ).Player;
			Angle = ( float ) Math.Atan2 ( player.Y - Y, player.X - X ) + 3.141592f / 2;
			AttackPoint = 5;
			timer = new Timer ( 1500 );
		}

		public override void Update ( GameTime gameTime )
		{
			timer.Update(gameTime);
			if ( isFollowMode && !timer.CheckTimer )
			{
				Player player = ( ( Game.Components [ 0 ] as Transitor ).CurrentScene as GameScene ).Player;
				Angle = ( float ) Math.Atan2 ( player.Y - Y, player.X - X ) + 3.141592f / 2;
			}
			else
			{
				isFollowMode = false;
				timer.Reset ();
			}
			base.Update ( gameTime );
		}
	}
}
