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

namespace ShootingHero.Components
{
	public class MonsterBullet : Bullet
	{
		int attackPoint;

		public int AttackPoint { get { return attackPoint; } set { attackPoint = value; } }

		public MonsterBullet ( Game game, float x, float y, float angle, float speed )
			: base ( game, x, y, angle, speed )
		{

		}

		public override void Update ( GameTime gameTime )
		{
			GameScene gameScene = ( ( Game.Components [ 0 ] as Transitor ).CurrentScene as GameScene );
			Player player = gameScene.Player;
			if ( MathHelper.Distance ( new Vector2 ( player.X, player.Y ), new Vector2 ( X, Y ) )
				<= Texture.Width / 2 - 1 + 8 )
			{
				gameScene.EffectManager.Add ( X, Y, true );
				gameScene.BulletManager.Remove ( this );
				if ( player.IsBarrierMode )
					player.IsBarrierMode = false;
				else
					player.HealthPoint -= AttackPoint;
				player.Score -= 5;
				PlaySound ();
			}

			base.Update ( gameTime );
		}
	}
}
