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

namespace ShootingHero.Components
{
	public class Boss : Monster
	{
		BossAnimation bossAnimation;
		bool tada = false;
		int tadaPosition = 200;

		protected new Texture2D Texture { get { return bossAnimation.Texture; } set { bossAnimation.Texture = value; } }
		protected int TadaPosition { get { return tadaPosition; } set { tadaPosition = value; } }

		public Boss ( Game game, float timeUnit, int hp )
			: base ( game, 240, 0, timeUnit, hp )
		{
			bossAnimation = new BossAnimation ( null );
			Y = -100;
		}

		public override void Update ( GameTime gameTime )
		{
			GameScene gameScene = ( ( Game as ShootingHero ).Components [ 0 ] as Transitor ).CurrentScene as GameScene;
			if ( CheckTimeUnit ) return;

			Timer.Update ( gameTime );
			if ( Timer.CheckTimer )
			{
				ShootBullet ( ( ( Game.Components [ 0 ] as Transitor ).CurrentScene as GameScene ).BulletManager );
				Timer.Reset ();
			}

			if ( !tada )
			{
				Y += gameTime.ElapsedGameTime.Milliseconds / 10.0f;
				if ( Y >= TadaPosition )
				{
					Y = TadaPosition;
					tada = true;
				}
			}
			else
			{
				MoveLogic ( gameTime );
			}
		}

		protected virtual void MoveLogic ( GameTime gameTime )
		{
		
		}

		public override void Draw ( GameTime gameTime )
		{
			GameScene gameScene = ( Game.Components [ 0 ] as Transitor ).CurrentScene as GameScene;
			if ( CheckTimeUnit ) return;

			SpriteBatch spriteBatch = ( Game as ShootingHero ).SpriteBatch;
			bossAnimation.DrawAnimation ( spriteBatch, new Vector2 ( X - Texture.Width / 8, Y - Texture.Height / 2 ) );
		}
	}
}
