diff --git a/MrBigsock/Assets/Code/PlayerController.cs b/MrBigsock/Assets/Code/PlayerController.cs index a84819a067f4386f506818cf354fb4bcc0448779..1780cd972438f88914bc8c33d50dfaf55ce25a7a 100644 --- a/MrBigsock/Assets/Code/PlayerController.cs +++ b/MrBigsock/Assets/Code/PlayerController.cs @@ -48,34 +48,35 @@ namespace BigSock { Adds damage to the player if they don't have IFrames. */ public bool TakeDamage(double amount) { - print($"[PlayerController.TakeDamage()] start. | {HP} - {amount}"); - // Check if player has IFrames - if(NextTimeCanTakeDamage > DateTime.Now) - return false; - // Start new IFrames - NextTimeCanTakeDamage = DateTime.Now + IFrameDuration; + // Check if player has IFrames + if(NextTimeCanTakeDamage > DateTime.Now) + return false; + // Start new IFrames + NextTimeCanTakeDamage = DateTime.Now + IFrameDuration; - // Add damage - HP -= amount; + print($"[PlayerController.TakeDamage()] start. | {HP} - {amount}"); - TryKill(); + // Add damage + HP -= amount; - return true; + TryKill(); + + return true; } /* Try to kill the player. */ public bool TryKill() { + if(Alive && HP <= 0) { print($"[PlayerController.TryKill()] start. | {HP}, {Alive}"); - if(Alive && HP <= 0) { - Alive = false; + Alive = false; - LockMovement(); + LockMovement(); - return true; - } - return false; + return true; + } + return false; } private void FixedUpdate() {