using System;
using System.Collections.Generic;
using System.Text;
using HumanLikeBattleRobots.Graphic;
using HumanLikeBattleRobots.Data;

namespace HumanLikeBattleRobots.Logic
{
    class MachineGun: Weapon
    {
        private bool isLeft;
        public MachineGun(Vec2f position, Vec2f normal, bool isLeft, bool isEnemy)
            : base(position, normal, isEnemy)
        {
            cooldownPeriod = 0.05f;
            health = 20;
            weaponSprite = new MachinegunSprite(3, isLeft);
            this.isLeft = isLeft;
        }

        protected sealed override void OnFire(Vec2f aimPosition)
        {
            if (!GameManager.Mute)
                Bass.Bass.BASS_SamplePlayEx(SoundResources.Machinegun[GameManager.MainRandom.Next(3)], 
                    0, 0, 30, 0, false);
            if (isLeft)
                new SimpleBullet(this.position + this.normal * 43 - this.normal.Rotate(Math.PI/2)*20, 
                    this.normal * 450, isEnemy);
            else
                new SimpleBullet(this.position + this.normal * 43 + this.normal.Rotate(Math.PI / 2) * 16,
                    this.normal * 450, isEnemy);
        }
    }
}
