Files
ClearTheZone/Assets/Scripts/Shoot.cs
T
2026-08-20 11:35:03 +02:00

46 lines
1.3 KiB
C#

//Oliver
using Unity.VisualScripting;
using UnityEngine;
public class Shoot : MonoBehaviour
{
[SerializeField] GameObject bulletPrefab;
[SerializeField] Transform spawnPointAR;
[SerializeField] Transform spawnPointPistol;
[SerializeField] bool AR = true;
[SerializeField] bool Pistole = true;
void Start()
{
<<<<<<< HEAD
=======
if (weapon == null)
weapon = FindFirstObjectByType<WeaponReload>();
>>>>>>> parent of 392d236 (Merge branch 'main' of https://git.bib.de/PBA3H25ABU/ClearTheZone)
}
void Update()
{
<<<<<<< HEAD
if ( AR == true && Input.GetKey(KeyCode.Mouse0))
=======
if (PauseMenu.GameIsPaused) return;
if (AR == true && Input.GetKey(KeyCode.Mouse0) && Time.time >= nextShotTime)
>>>>>>> parent of 392d236 (Merge branch 'main' of https://git.bib.de/PBA3H25ABU/ClearTheZone)
{
Shot(spawnPointAR);
}
else if (Pistole == true && Input.GetKeyDown(KeyCode.Mouse0))
{
Shot(spawnPointPistol);
}
}
public void Shot(Transform spawnPoint)
{
GameObject bullet = Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation);
bullet.transform.Rotate(90,0,0);
Destroy(bullet, 2);
}
}