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.Components.Manager;
using ShootingHero.Components.Bullets.PlayerBullet;

namespace ShootingHero.Components.Players
{
	public class Calix : Player
	{
		Texture2D barrier;
		int boomCount = 0;

		public Calix ( Game game )
			: base ( game, Character.Gloria )
		{ 
			
		}

		protected override void LoadContent ()
		{
			base.LoadContent ();
			Animation.Texture = Game.Content.Load<Texture2D> ( "Character/calix" );
			barrier = Game.Content.Load<Texture2D> ( "Bullet/calix_shield" );
		}

		public override void ShootBullet ( BulletManager bulletManager )
		{
			if ( boomCount <= 0 )
				bulletManager.Add ( new CalixBullet ( Game, X, Y - 40, 0 ) );
			else
			{
				for ( int i = 0; i < 360; i += 30 )
					bulletManager.Add ( new CalixBullet ( Game, X, Y,
						Microsoft.Xna.Framework.MathHelper.ToRadians ( i ) ) );
				boomCount--;
			}
		}

		public override void Boom ( BulletManager bulletManager )
		{
			boomCount = 3;
		}

		public override void LevelUp ()
		{
			IsBarrierMode = true;
		}

		public override void Change ()
		{
			IsBarrierMode = true;
		}

		public override void Draw ( GameTime gameTime )
		{
			base.Draw ( gameTime );
			if ( IsBarrierMode )
			{
				SpriteBatch spriteBatch = ( Game as ShootingHero ).SpriteBatch;
				spriteBatch.Draw ( barrier, new Vector2 ( X - barrier.Width / 2, Y - barrier.Height / 2 ),
					Color.White );
			}
		}
	}
}
