Reload Animation von Ar und Pistole außerdem Shot script soweit fertig

This commit is contained in:
2026-06-25 12:42:14 +02:00
parent f66d78348a
commit d7d88fe70a
13 changed files with 655 additions and 24 deletions
+16 -6
View File
@@ -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);
}
}