waffen realoden reapriert
This commit is contained in:
+11
-2
@@ -6,19 +6,26 @@ public class Shoot : MonoBehaviour
|
||||
[SerializeField] GameObject bulletPrefab;
|
||||
[SerializeField] Transform spawnPointAR;
|
||||
[SerializeField] Transform spawnPointPistol;
|
||||
[SerializeField] WeaponReload weapon;
|
||||
[SerializeField] float fireRate = 0.15f;
|
||||
[SerializeField] bool AR = true;
|
||||
[SerializeField] bool Pistole = true;
|
||||
private float nextShotTime;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
if (weapon == null)
|
||||
weapon = FindFirstObjectByType<WeaponReload>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (PauseMenu.GameIsPaused) return;
|
||||
|
||||
if ( AR == true && Input.GetKey(KeyCode.Mouse0))
|
||||
if (AR == true && Input.GetKey(KeyCode.Mouse0) && Time.time >= nextShotTime)
|
||||
{
|
||||
Shot(spawnPointAR);
|
||||
nextShotTime = Time.time + fireRate;
|
||||
}
|
||||
else if (Pistole == true && Input.GetKeyDown(KeyCode.Mouse0))
|
||||
{
|
||||
@@ -27,6 +34,8 @@ public class Shoot : MonoBehaviour
|
||||
}
|
||||
public void Shot(Transform spawnPoint)
|
||||
{
|
||||
if (spawnPoint == null || weapon == null || !weapon.UseAmmo()) return;
|
||||
|
||||
GameObject bullet = Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation);
|
||||
bullet.transform.Rotate(90,0,0);
|
||||
Destroy(bullet, 2);
|
||||
|
||||
Reference in New Issue
Block a user