Blood of CUBE runs thin after being hit now

This commit is contained in:
Arlo Filley 2024-11-24 17:12:13 +00:00
parent b5c039edd3
commit 7ca2bd0b30

View File

@ -7,6 +7,7 @@ using UnityEditor;
public class PlayerController : MonoBehaviour public class PlayerController : MonoBehaviour
{ {
[Header("Keybinds")] [Header("Keybinds")]
public KeyCode forwardKey = KeyCode.W; public KeyCode forwardKey = KeyCode.W;
public KeyCode backwardKey = KeyCode.S; public KeyCode backwardKey = KeyCode.S;
@ -25,8 +26,6 @@ public class PlayerController : MonoBehaviour
public KeyCode dashKey = KeyCode.LeftShift; public KeyCode dashKey = KeyCode.LeftShift;
public bool canDash = true; public bool canDash = true;
public float dashCooldownTimer = 0f; public float dashCooldownTimer = 0f;
[Header("Particles")]
public ParticleSystem particleSystem; public ParticleSystem particleSystem;
public Transform particleTransform; public Transform particleTransform;
@ -35,6 +34,7 @@ public class PlayerController : MonoBehaviour
public string enemyTag = "Enemy"; public string enemyTag = "Enemy";
public float invulnerabilityTimeSeconds = 0.25f; public float invulnerabilityTimeSeconds = 0.25f;
public int lives = 3; public int lives = 3;
public ParticleSystem bloodParticleSystem;
[Header("Audio")] [Header("Audio")]
public AudioSource metalPipe; public AudioSource metalPipe;
@ -124,16 +124,19 @@ public class PlayerController : MonoBehaviour
void HandlePlayerHit() void HandlePlayerHit()
{ {
lastHit = Time.time;
metalPipe.Play(); // Play damage sound effect
lives--; lives--;
// Update visual feedback (if any) for losing a life, e.g. hearts
if (lives <= 0) if (lives <= 0)
{ {
ExitGame(); ExitGame();
} }
bloodParticleSystem.Play();
lastHit = Time.time;
metalPipe.Play(); // Play damage sound effect
// Update visual feedback (if any) for losing a life, e.g. hearts
} }
void ExitGame() void ExitGame()