using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using ECOT.Game.States;
using ECOT.Engine;

namespace ECOT.Game
{
    public class Bullet
    {
        private int number;
        protected Texture2D texture = MiniGameBase.Content.Load<Texture2D>("ECOT_MiniGame_Shoot_ammo");
        private Texture2D reloadTexture = MiniGameBase.Content.Load<Texture2D>("ECOT_MiniGame_Shoot_reload");
        private Sound bulletSound;

        public int Number
        {
            get { return this.number; }
            set { this.number = value; }
        }

        public Bullet() 
        {
            this.number = 5; 
            this.bulletSound = new Sound();
        }

        public void Render(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < this.number; i++)
                spriteBatch.Draw(this.texture, new Vector2(20 + i * 30, 150), null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.1f);
            if (this.number == 0)
                spriteBatch.Draw(this.reloadTexture,
                    new Vector2(
                        (Kernel.Instance.Width - this.reloadTexture.Width) / 2,
                        (Kernel.Instance.Height - this.reloadTexture.Height) / 2),
                    null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f);
        }

        public void ReloadBullet()
        {
            this.number = 5;
            this.bulletSound.PlayEffect("ECOT_Sound_Effet_Reload");
        }
    }
}
