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
24a1bfd2
Commit
24a1bfd2
authored
2 years ago
by
Robin Halseth Sandvik
Browse files
Options
Downloads
Patches
Plain Diff
Added support for stun status effect.
parent
bc266f3e
No related branches found
Branches containing commit
No related tags found
1 merge request
!34
Dodge
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MrBigsock/Assets/Code/Character.cs
+47
-0
47 additions, 0 deletions
MrBigsock/Assets/Code/Character.cs
with
47 additions
and
0 deletions
MrBigsock/Assets/Code/Character.cs
+
47
−
0
View file @
24a1bfd2
...
@@ -471,6 +471,17 @@ namespace BigSock {
...
@@ -471,6 +471,17 @@ namespace BigSock {
/*
Is the character stunned.
*/
public
bool
IsStunned
=>
NextTimeNotStunned
>
DateTime
.
Now
;
/*
Stores the next time the character can isn't stunned.
*/
public
DateTime
NextTimeNotStunned
{
get
;
private
set
;
}
=
DateTime
.
Now
;
/*
/*
Is the character visible.
Is the character visible.
...
@@ -503,12 +514,48 @@ namespace BigSock {
...
@@ -503,12 +514,48 @@ namespace BigSock {
switch
(
statusType
)
{
switch
(
statusType
)
{
case
StatusEffectType
.
Invincible
:
return
AddIFrames
(
amount
);
case
StatusEffectType
.
Invincible
:
return
AddIFrames
(
amount
);
case
StatusEffectType
.
Invisible
:
return
AddInvisibility
(
amount
);
case
StatusEffectType
.
Invisible
:
return
AddInvisibility
(
amount
);
case
StatusEffectType
.
Stun
:
return
AddStun
(
amount
);
default
:
return
false
;
default
:
return
false
;
}
}
}
}
/*
Adds Stun for the character.
*/
public
bool
AddStun
(
TimeSpan
amount
)
{
// Get when the status effect would expire.
var
wouldExpire
=
DateTime
.
Now
+
IFrameDuration
;
// Only if that's later than current.
if
(
wouldExpire
>
NextTimeNotStunned
)
{
// If character currently doesn't have the status effect.
if
(
NextTimeNotStunned
<
DateTime
.
Now
)
{
ApplyStun
();
}
// Set new time.
NextTimeNotStunned
=
wouldExpire
;
return
true
;
}
return
false
;
}
/*
Appies Stun to the character.
*/
private
void
ApplyStun
()
{
}
/*
Removes Stun for the character.
*/
private
void
RemoveStun
()
{
}
/*
/*
Adds invisibility for the character.
Adds invisibility for the character.
*/
*/
...
...
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