waffen realoden reapriert

This commit is contained in:
NBTEMP\bib
2026-08-20 10:43:24 +02:00
parent e8d6a385c4
commit 4a23cacf12
8 changed files with 84 additions and 69 deletions
+10 -10
View File
@@ -1206,16 +1206,16 @@ MonoBehaviour:
m_MoveRepeatRate: 0.1 m_MoveRepeatRate: 0.1
m_XRTrackingOrigin: {fileID: 0} m_XRTrackingOrigin: {fileID: 0}
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_PointAction: {fileID: 1054132383583890850, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_MoveAction: {fileID: 3710738434707379630, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_SubmitAction: {fileID: 2064916234097673511, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_CancelAction: {fileID: -1967631576421560919, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_LeftClickAction: {fileID: 8056856818456041789, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_MiddleClickAction: {fileID: 3279352641294131588, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_RightClickAction: {fileID: 3837173908680883260, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_ScrollWheelAction: {fileID: 4502412055082496612, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_TrackedDevicePositionAction: {fileID: 4754684134866288074, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_TrackedDeviceOrientationAction: {fileID: 1025543830046995696, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_DeselectOnBackgroundClick: 1 m_DeselectOnBackgroundClick: 1
m_PointerBehavior: 0 m_PointerBehavior: 0
m_CursorLockBehavior: 0 m_CursorLockBehavior: 0
+21 -33
View File
@@ -170,7 +170,7 @@ MonoBehaviour:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392} m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@@ -214,6 +214,8 @@ MonoBehaviour:
bulletPrefab: {fileID: 4474395191186681843, guid: afa71643f370d394e8dd19e0ab40ab57, type: 3} bulletPrefab: {fileID: 4474395191186681843, guid: afa71643f370d394e8dd19e0ab40ab57, type: 3}
spawnPointAR: {fileID: 2136079773} spawnPointAR: {fileID: 2136079773}
spawnPointPistol: {fileID: 0} spawnPointPistol: {fileID: 0}
weapon: {fileID: 1546402530}
fireRate: 0.15
AR: 1 AR: 1
Pistole: 1 Pistole: 1
--- !u!114 &50826114 --- !u!114 &50826114
@@ -486,10 +488,10 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 1985753437} - m_Target: {fileID: 535044339}
m_TargetAssemblyTypeName: PausenManager, Assembly-CSharp m_TargetAssemblyTypeName: PauseMenu, Assembly-CSharp
m_MethodName: lobby m_MethodName: ResumeGame
m_Mode: 5 m_Mode: 1
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
@@ -847,16 +849,16 @@ MonoBehaviour:
m_MoveRepeatRate: 0.1 m_MoveRepeatRate: 0.1
m_XRTrackingOrigin: {fileID: 0} m_XRTrackingOrigin: {fileID: 0}
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_PointAction: {fileID: 1054132383583890850, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_MoveAction: {fileID: 3710738434707379630, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_SubmitAction: {fileID: 2064916234097673511, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_CancelAction: {fileID: -1967631576421560919, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_LeftClickAction: {fileID: 8056856818456041789, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_MiddleClickAction: {fileID: 3279352641294131588, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_RightClickAction: {fileID: 3837173908680883260, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_ScrollWheelAction: {fileID: 4502412055082496612, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_TrackedDevicePositionAction: {fileID: 4754684134866288074, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} m_TrackedDeviceOrientationAction: {fileID: 1025543830046995696, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_DeselectOnBackgroundClick: 1 m_DeselectOnBackgroundClick: 1
m_PointerBehavior: 0 m_PointerBehavior: 0
m_CursorLockBehavior: 0 m_CursorLockBehavior: 0
@@ -974,9 +976,9 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 1985753437} - m_Target: {fileID: 535044339}
m_TargetAssemblyTypeName: PausenManager, Assembly-CSharp m_TargetAssemblyTypeName: PauseMenu, Assembly-CSharp
m_MethodName: Quit m_MethodName: QuitGame
m_Mode: 1 m_Mode: 1
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
@@ -1573,7 +1575,7 @@ RectTransform:
m_GameObject: {fileID: 1597635426} m_GameObject: {fileID: 1597635426}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1783601023} - {fileID: 1783601023}
@@ -1850,7 +1852,6 @@ GameObject:
- component: {fileID: 1985753435} - component: {fileID: 1985753435}
- component: {fileID: 1985753434} - component: {fileID: 1985753434}
- component: {fileID: 1985753433} - component: {fileID: 1985753433}
- component: {fileID: 1985753437}
m_Layer: 5 m_Layer: 5
m_Name: "pausenmen\xFC" m_Name: "pausenmen\xFC"
m_TagString: Untagged m_TagString: Untagged
@@ -1944,19 +1945,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!114 &1985753437
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1985753432}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 33345f0f372370e4d903e361cc6ec87c, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PausenManager
pauseMenuUI: {fileID: 0}
--- !u!1 &2041741097 --- !u!1 &2041741097
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+2
View File
@@ -26,6 +26,8 @@ public class Door_Rotate : MonoBehaviour
void Update() void Update()
{ {
if (PauseMenu.GameIsPaused) return;
if (Input.GetKeyDown(KeyCode.E) && IsPlayerLooking()) if (Input.GetKeyDown(KeyCode.E) && IsPlayerLooking())
{ {
ToggleDoor(); ToggleDoor();
+2
View File
@@ -19,6 +19,8 @@ public class EquipmentManager : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (PauseMenu.GameIsPaused) return;
if(Input.GetKeyDown(KeyCode.Alpha2) && PistoleIsOn == false) if(Input.GetKeyDown(KeyCode.Alpha2) && PistoleIsOn == false)
{ {
AR.SetActive(false); AR.SetActive(false);
+19 -4
View File
@@ -6,14 +6,19 @@ public class PauseMenu : MonoBehaviour
public GameObject pauseMenuUI; // Das Pausenmenü-Panel public GameObject pauseMenuUI; // Das Pausenmenü-Panel
public GameObject hudUI; // Die Lebens- und Munitionsanzeige (HUD) public GameObject hudUI; // Die Lebens- und Munitionsanzeige (HUD)
private bool isPaused = false; public static bool GameIsPaused = false;
void Start()
{
ResumeGame();
}
void Update() void Update()
{ {
// Überprüft, ob die ESC-Taste gedrückt wurde // Überprüft, ob die ESC-Taste gedrückt wurde
if (Input.GetKeyDown(KeyCode.Escape)) if (Input.GetKeyDown(KeyCode.Escape))
{ {
if (isPaused) if (GameIsPaused)
{ {
ResumeGame(); ResumeGame();
} }
@@ -29,7 +34,7 @@ public class PauseMenu : MonoBehaviour
pauseMenuUI.SetActive(true); // Pausenmenü anzeigen pauseMenuUI.SetActive(true); // Pausenmenü anzeigen
hudUI.SetActive(false); // Lebens- & Munitionsanzeige ausblenden hudUI.SetActive(false); // Lebens- & Munitionsanzeige ausblenden
Time.timeScale = 0f; // Spielzeit anhalten Time.timeScale = 0f; // Spielzeit anhalten
isPaused = true; GameIsPaused = true;
// MAUSZEIGER FREIGEBEN (damit man Knöpfe drücken kann) // MAUSZEIGER FREIGEBEN (damit man Knöpfe drücken kann)
Cursor.lockState = CursorLockMode.None; Cursor.lockState = CursorLockMode.None;
@@ -41,10 +46,20 @@ public class PauseMenu : MonoBehaviour
pauseMenuUI.SetActive(false); // Pausenmenü ausblenden pauseMenuUI.SetActive(false); // Pausenmenü ausblenden
hudUI.SetActive(true); // Lebens- & Munitionsanzeige wieder anzeigen hudUI.SetActive(true); // Lebens- & Munitionsanzeige wieder anzeigen
Time.timeScale = 1f; // Spielzeit weiterlaufen lassen Time.timeScale = 1f; // Spielzeit weiterlaufen lassen
isPaused = false; GameIsPaused = false;
// MAUSZEIGER WIEDER SPERREN (fürs Gameplay) // MAUSZEIGER WIEDER SPERREN (fürs Gameplay)
Cursor.lockState = CursorLockMode.Locked; Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false; Cursor.visible = false;
} }
public void QuitGame()
{
Time.timeScale = 1f;
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
} }
+6
View File
@@ -16,6 +16,12 @@ public class PlayerController : MonoBehaviour
void Update() void Update()
{ {
if (PauseMenu.GameIsPaused)
{
position = Vector3.zero;
return;
}
position = Vector3.zero; position = Vector3.zero;
if (Input.GetKey(KeyCode.W)) if (Input.GetKey(KeyCode.W))
{ {
+11 -2
View File
@@ -6,19 +6,26 @@ public class Shoot : MonoBehaviour
[SerializeField] GameObject bulletPrefab; [SerializeField] GameObject bulletPrefab;
[SerializeField] Transform spawnPointAR; [SerializeField] Transform spawnPointAR;
[SerializeField] Transform spawnPointPistol; [SerializeField] Transform spawnPointPistol;
[SerializeField] WeaponReload weapon;
[SerializeField] float fireRate = 0.15f;
[SerializeField] bool AR = true; [SerializeField] bool AR = true;
[SerializeField] bool Pistole = true; [SerializeField] bool Pistole = true;
private float nextShotTime;
void Start() void Start()
{ {
if (weapon == null)
weapon = FindFirstObjectByType<WeaponReload>();
} }
void Update() 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); Shot(spawnPointAR);
nextShotTime = Time.time + fireRate;
} }
else if (Pistole == true && Input.GetKeyDown(KeyCode.Mouse0)) else if (Pistole == true && Input.GetKeyDown(KeyCode.Mouse0))
{ {
@@ -27,6 +34,8 @@ public class Shoot : MonoBehaviour
} }
public void Shot(Transform spawnPoint) public void Shot(Transform spawnPoint)
{ {
if (spawnPoint == null || weapon == null || !weapon.UseAmmo()) return;
GameObject bullet = Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation); GameObject bullet = Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation);
bullet.transform.Rotate(90,0,0); bullet.transform.Rotate(90,0,0);
Destroy(bullet, 2); Destroy(bullet, 2);
+11 -18
View File
@@ -17,6 +17,8 @@ public class WeaponReload : MonoBehaviour
void Update() void Update()
{ {
if (PauseMenu.GameIsPaused) return;
// Während nachgeladen wird, keine Aktionen zulassen // Während nachgeladen wird, keine Aktionen zulassen
if (isReloading) if (isReloading)
return; return;
@@ -29,30 +31,21 @@ public class WeaponReload : MonoBehaviour
return; return;
} }
// 2. Automatisches Nachladen beim Schießen, wenn das Magazin leer (<= 0) ist
if (Input.GetButtonDown("Fire1"))
{
if (currentAmmo > 0)
{
Shoot();
}
else
{
// Magazin ist leer -> automatisch nachladen!
StartCoroutine(Reload());
}
}
} }
void Shoot() public bool UseAmmo()
{ {
// Nur schießen, wenn das Pausemenü NICHT offen ist if (PauseMenu.GameIsPaused || isReloading) return false;
if (PausenManager.GameIsPaused) return;
if (currentAmmo <= 0)
{
StartCoroutine(Reload());
return false;
}
currentAmmo--; currentAmmo--;
Debug.Log("Schuss gefeuert! Verbleibende Munition: " + currentAmmo); Debug.Log("Schuss gefeuert! Verbleibende Munition: " + currentAmmo);
return true;
// Hier deinen normalen Schuss-Code einfügen (Raycast, Bullet-Prefab, Ton etc.)
} }
// Coroutine für die Nachlade-Verzögerung // Coroutine für die Nachlade-Verzögerung