using UnityEngine;
using UnityEngine.InputSystem;

public class GunController : MonoBehaviour
{
  [SerializeField]
  private Transform muzzle;
  [SerializeField]
  private InputActionProperty Trigger;

  public float shotsPerSecond = 1.0f;
  public float projectileSpeed = 1.0f;

  public GameObject projectileObject;




  // Start is called once before the first execution of Update after the MonoBehaviour is created
  void Start()
  {

  }

  // Update is called once per frame
  void Update()
  {
    if (Trigger.action.IsPressed())
    {
      GameObject spawnedObject = Instantiate(projectileObject);
      Projectile projectileScript = spawnedObject.GetComponent<Projectile>();

      if (projectileScript != null) {
        projectileScript.Direction = Vector3.up;
      }

      Debug.Log("Shoot");
    }
  }
}
