using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class Weapons : MonoBehaviour
{
    private Inputs Input;
    private InputAction Shoot;
    private void Awake()
    {
        Input = new Inputs();
    }
    private void OnEnable()
    {
        Shoot = Input.Movement.attack;
        Shoot.Enable();
    }
    private void OnDisable()
    {
        Shoot.Disable();
    }
    private void Update()
    {
        if(Shoot.IsPressed())
        {
            shoot();
        }
    }
    private void shoot()
    {
        if(transform.childCount > 0)
        {
            Transform gun = transform.GetChild(0);
            gun.GetComponent<Weapon>().shoot();
        }
    }
}
