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
b1bafae1
Commit
b1bafae1
authored
2 years ago
by
Robin Halseth Sandvik
Browse files
Options
Downloads
Patches
Plain Diff
Made the player ability code update the ability ui.
- Also reset charge on fire.
parent
75d9081a
No related branches found
Branches containing commit
No related tags found
1 merge request
!84
Merge, ability cluster
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MrBigsock/Assets/Code/PlayerController.cs
+9
-3
9 additions, 3 deletions
MrBigsock/Assets/Code/PlayerController.cs
with
9 additions
and
3 deletions
MrBigsock/Assets/Code/PlayerController.cs
+
9
−
3
View file @
b1bafae1
...
...
@@ -20,6 +20,7 @@ namespace BigSock {
public
const
int
SKILL_POINTS_START
=
0
;
// Skill points to start with.
public
const
float
XP_SCALE_RATE
=
3.0f
;
// Multiplier for xp gain, helps test system while game is tiny.
public
const
int
ABILITY_COUNT
=
4
;
// Number of abilities.
public
UtilBar
utilBar
;
...
...
@@ -37,6 +38,9 @@ namespace BigSock {
bool
canMove
=
true
;
// The UI component for displaying abilities.
private
AbilityCluster
AbilityUI
;
// The abilities of the player.
private
List
<
AbilityEntity
>
_abilities
=
new
List
<
AbilityEntity
>();
...
...
@@ -94,6 +98,7 @@ namespace BigSock {
animator
=
GetComponent
<
Animator
>();
spriteRenderer
=
GetComponent
<
SpriteRenderer
>();
AbilityUI
=
GameObject
.
Find
(
"AbilityCluster"
)?.
GetComponent
<
AbilityCluster
>();
//!! DEBUG: Add item to player at start to test if it works.
...
...
@@ -106,7 +111,6 @@ namespace BigSock {
//var tmp = PrefabService.SINGLETON;
//var tmp = SpriteService.SINGLETON;
// Get the abilities and set them up.
var
aService
=
AbilityService
.
SINGLETON
;
var
abilities
=
new
List
<
IAbility
>
{
...
...
@@ -115,6 +119,7 @@ namespace BigSock {
aService
.
Get
(
101
),
aService
.
Get
(
201
),
};
AbilityUI
?.
SetElements
(
ABILITY_COUNT
);
SetAbilities
(
abilities
);
//_testAttack = (IAttack)AbilityService.SINGLETON.Get(104);
...
...
@@ -181,8 +186,8 @@ namespace BigSock {
if
(
CheckAbilityInput
(
key
,
ability
))
break
;
// Update the UI.
//>
AbilityUI?.
Update
Charge(ability.Index, ability.ChargePercent);
//>
AbilityUI?.
Update
Cooldown(ability.Index, ability.CooldownPercent);
AbilityUI
?.
Set
Charge
(
ability
.
Index
,
ability
.
ChargePercent
);
AbilityUI
?.
Set
Cooldown
(
ability
.
Index
,
ability
.
CooldownPercent
);
}
...
...
@@ -219,6 +224,7 @@ namespace BigSock {
if
(
par
.
ChargeTime
<
ability
.
Ability
.
MinCharge
)
Debug
.
Log
(
$"[PlayerController.CheckAbilityInput(
{
key
}
)]
{
ability
.
Ability
.
Name
}
not fired (
{
par
.
ChargeTime
:
N3
}
<
{
ability
.
Ability
.
MinCharge
:
N3
}
)"
);
}
ability
.
ChargeStarted
=
0f
;
// Reset charge time when we release the key.
return
true
;
}
break
;
...
...
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