Merge branch 'main' of https://git.bib.de/PBA3H25ABU/ClearTheZone
This commit is contained in:
+16
-6
@@ -1,24 +1,34 @@
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class Shoot : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject bulletPrefab;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
[SerializeField] Transform spawnPointAR;
|
||||
[SerializeField] Transform spawnPointPistol;
|
||||
[SerializeField] bool AR = true;
|
||||
[SerializeField] bool Pistole = true;
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Mouse0))
|
||||
|
||||
if ( AR == true && Input.GetKey(KeyCode.Mouse0))
|
||||
{
|
||||
Shot();
|
||||
Shot(spawnPointAR);
|
||||
}
|
||||
else if (Pistole == true && Input.GetKeyDown(KeyCode.Mouse0))
|
||||
{
|
||||
Shot(spawnPointPistol);
|
||||
}
|
||||
}
|
||||
public void Shot()
|
||||
public void Shot(Transform spawnPoint)
|
||||
{
|
||||
Instantiate(bulletPrefab);
|
||||
GameObject bullet = Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation);
|
||||
bullet.transform.Rotate(90,0,0);
|
||||
Destroy(bullet, 2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user