public void Fire() { if (shootCount >= magazineSize) { return; } // Raycast Ray ray = new Ray(FirePoint.position, FirePoint.forward); Debug.DrawRay(ray.origin, ray.direction * 1000f, Color.red, 3f); Physics.Raycast(ray, out RaycastHit hit, float.MaxValue, targetLayerMask); if (hit.collider) { Debug.Log(hit.transform.name); hit.transform.GetComponent <ShootingTarget>().TargetHit(); } shootCount++; OnGunFire.Invoke(magazineSize - shootCount); }
public void Reload() { shootCount = 0; OnGunFire.Invoke(magazineSize - shootCount); }