TO SQUASH: Added player gun and pause.

This commit is contained in:
2026-07-28 00:44:11 -04:00
parent 787d5394c7
commit 7a6c2802f4
47 changed files with 5893 additions and 6 deletions
+49
View File
@@ -0,0 +1,49 @@
using UnityEngine;
using UnityEngine.InputSystem;
public class Pause : MonoBehaviour
{
public SpriteRenderer pauseBacgkround;
public SpriteRenderer pauseLabel;
public AudioClip pauseSound;
public MusicManager musicManager;
private bool isPaused = false;
private AudioSource audioSource;
private static Color colorBlackTransparent = new Color(0.0f, 0.0f, 0.0f, 0.0f);
private static Color colorBlackOpaque = new Color(0.0f, 0.0f, 0.0f, 1.0f);
private static Color colorWhiteTransparent = new Color(1.0f, 1.0f, 1.0f, 0.0f);
private static Color colorWhiteOpaque = new Color(1.0f, 1.0f, 1.0f, 1.0f);
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
if (Keyboard.current != null && Keyboard.current.capsLockKey.wasPressedThisFrame)
{
isPaused = !isPaused;
pauseBacgkround.color = isPaused ? colorBlackOpaque : colorBlackTransparent;
pauseLabel.color = isPaused ? colorWhiteOpaque : colorWhiteTransparent;
if (isPaused)
{
audioSource.PlayOneShot(pauseSound);
musicManager.pauseMusic();
}
else
{
musicManager.resumeMusic();
}
}
}
}