Skip to content
Snippets Groups Projects
Commit ac09ac48 authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Moved some prints to reduce clutter.

parent b69048c1
No related branches found
No related tags found
1 merge request!8Mouse pointer & attack speed.
......@@ -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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment