Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mr BigSock
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gard Aleksander Furre
Mr BigSock
Commits
ac09ac48
Commit
ac09ac48
authored
2 years ago
by
Robin Halseth Sandvik
Browse files
Options
Downloads
Patches
Plain Diff
Moved some prints to reduce clutter.
parent
b69048c1
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
Mouse pointer & attack speed.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MrBigsock/Assets/Code/PlayerController.cs
+17
-16
17 additions, 16 deletions
MrBigsock/Assets/Code/PlayerController.cs
with
17 additions
and
16 deletions
MrBigsock/Assets/Code/PlayerController.cs
+
17
−
16
View file @
ac09ac48
...
...
@@ -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
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment