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

34 lines
806 B
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()
{
}
void Update()
{
if (AR == true && Input.GetKey(KeyCode.Mouse0))
{
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);
}
}