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
Merge requests
!84
Merge, ability cluster
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Merge, ability cluster
JuliusesNyeSuperBranch
into
main
Overview
0
Commits
20
Pipelines
0
Changes
32
Merged
Julius Fredrik Einum
requested to merge
JuliusesNyeSuperBranch
into
main
2 years ago
Overview
0
Commits
20
Pipelines
0
Changes
32
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
e304a1a4
20 commits,
2 years ago
32 files
+
266
−
80
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
32
Search (e.g. *.vue) (Ctrl+P)
MrBigsock/Assets/Code/Core/Abilities/Base/AbilityEntity.cs
0 → 100644
+
52
−
0
Options
using
System.Collections
;
using
System
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.InputSystem
;
namespace
BigSock
{
/*
An object representing an ability held by a player.
*/
public
class
AbilityEntity
{
// The ability held in this slot.
public
IAbility
Ability
{
get
;
}
// The index of the ability
public
int
Index
{
get
;
}
// The time this ability started charging.
public
float
ChargeStarted
{
get
;
set
;
}
// The keys bound to this ability.
public
List
<
KeyCode
>
Keys
{
get
;
}
// Indicates whether or not the ability is charging.
public
bool
IsCharging
=>
ChargeStarted
>
0
;
// The time this ability has been charging.
public
float
ChargeTime
=>
Time
.
time
-
ChargeStarted
;
// The percent of maximum time the ability has charged for.
public
float
ChargePercent
=>
(
Ability
.
FireType
==
FireType
.
Charge
&&
IsCharging
)
?
Math
.
Clamp
(
ChargeTime
/
Ability
.
MaxCharge
,
0
,
1
)
:
0
;
// How far into the cooldown the attack is.
public
float
CooldownPercent
=>
(
float
)
Math
.
Clamp
((
DateTime
.
Now
-
Ability
.
NextTimeCanUse
+
Ability
.
Cooldown
)
/
Ability
.
Cooldown
,
0
,
1
);
public
AbilityEntity
(
IAbility
ability
,
int
index
,
List
<
KeyCode
>
keys
=
null
)
{
if
(
ability
==
null
)
throw
new
ArgumentNullException
(
nameof
(
ability
));
Ability
=
ability
;
Index
=
index
;
Keys
=
keys
??
new
List
<
KeyCode
>();
}
}
}
Loading