Weapon Script

PHOTO EMBED

Tue May 17 2022 18:33:57 GMT+0000 (UTC)

Saved by @BiscuitTinx #c#

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

public class Weapon : MonoBehaviour
{

    public Transform firePoint;
    public GameObject bulletPrefab;
    public Animator fireEffect;

    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            Shoot();
        }
    }

    //shooting logic
    void Shoot ()
    {
        Instantiate(bulletPrefab, firePoint.position, firePoint.transform.rotation);

        fireEffect.SetTrigger("Fire");
    }
}
content_copyCOPY