using UnityEngine;

public class WeaponHolder : MonoBehaviour
{
    public Transform throwTransform;
    public Transform ShootTransform;
    public Transform AimTransform;

    public Weapon[] Weapons;

    private float aimAngle = 0.0f;
    public float AimAngle {
        get { return aimAngle; }
        set
        {
            aimAngle = value;
            AimTransform.eulerAngles = new Vector3(0, 0, -aimAngle);
        }
    }

    private Weapon currentPrimaryWeapon;
    private Weapon currentSecondaryWeapon;

    private void Awake()
    {
        if (Weapons != null && Weapons.Length > 0)
            currentPrimaryWeapon = Weapons[0];
        if (Weapons != null && Weapons.Length > 1)
            currentSecondaryWeapon = Weapons[1];
    }

    public void FirePrimary()
    {
        if (currentPrimaryWeapon == null)
            return;

        currentPrimaryWeapon.Fire(this);
    }

    public void FireSecondary()
    {
        if (currentSecondaryWeapon == null)
            return;

        currentSecondaryWeapon.Fire(this);
    }
}
