using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shooting : MonoBehaviour
{
public Camera FPS_camera;
public GameObject hitEffectPrefab;
public void Fire()
{
RaycastHit _hit;
Ray ray = FPS_camera.ViewportPointToRay(new Vector3(0.5f, 0.5f));
if(Physics.Raycast(ray, out _hit, 1000))
{
Debug.Log(_hit.collider.gameObject.name);
GameObject hitEffectGameObeject = Instantiate(hitEffectPrefab, _hit.point, Quaternion.identity);
Destroy(hitEffectGameObeject, 0.5f);
}
}
}