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
257cdc83
Commit
257cdc83
authored
2 years ago
by
Julius Fredrik Einum
Browse files
Options
Downloads
Patches
Plain Diff
Added ability cluster full charge and cooldown func
parent
22197bd1
No related branches found
Branches containing commit
No related tags found
2 merge requests
!81
Main
,
!80
Juliuses nye super branch
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MrBigsock/Assets/Code/UI/AbilityCluster.cs
+20
-0
20 additions, 0 deletions
MrBigsock/Assets/Code/UI/AbilityCluster.cs
MrBigsock/Assets/Code/UI/AbilityElement.cs
+11
-11
11 additions, 11 deletions
MrBigsock/Assets/Code/UI/AbilityElement.cs
with
31 additions
and
11 deletions
MrBigsock/Assets/Code/UI/AbilityCluster.cs
+
20
−
0
View file @
257cdc83
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
BigSock.Service
;
namespace
BigSock.UI
{
public
class
AbilityCluster
:
MonoBehaviour
{
private
const
string
ABILITYELEMENT
=
"UI/Ability"
;
private
List
<
AbilityElement
>
abilityList
;
public
void
SetElements
(
int
elementAmount
)
{
for
(
int
i
=
0
;
i
<
elementAmount
;
++
i
)
{
abilityList
.
Add
(
PrefabService
.
SINGLETON
.
Instance
(
ABILITYELEMENT
,
transform
).
GetComponent
<
AbilityElement
>());
}
}
public
void
SetCooldown
(
int
index
,
float
amount
)
{
abilityList
[
index
].
WithCooldown
(
amount
);
}
public
void
SetCharge
(
int
index
,
float
amount
)
{
abilityList
[
index
].
WithCharge
(
amount
);
}
}
...
...
This diff is collapsed.
Click to expand it.
MrBigsock/Assets/Code/UI/AbilityElement.cs
+
11
−
11
View file @
257cdc83
...
...
@@ -8,31 +8,31 @@ namespace BigSock.UI
{
public
class
AbilityElement
:
MonoBehaviour
{
private
Slider
C
hargeSlider
,
Reload
Slider
;
private
Slider
c
hargeSlider
,
cooldown
Slider
;
public
AbilityElement
WithCharge
(
in
t
?
value
=
null
,
in
t
?
maxValue
=
null
)
public
AbilityElement
WithCharge
(
floa
t
?
value
=
null
,
floa
t
?
maxValue
=
null
)
{
if
(
value
!=
null
)
C
hargeSlider
.
value
=
value
.
Value
;
if
(
value
!=
null
)
c
hargeSlider
.
value
=
value
.
Value
;
if
(
maxValue
!=
null
)
C
hargeSlider
.
maxValue
=
maxValue
.
Value
;
if
(
maxValue
!=
null
)
c
hargeSlider
.
maxValue
=
maxValue
.
Value
;
return
this
;
}
public
AbilityElement
With
Reload
(
in
t
?
value
=
null
,
in
t
?
maxValue
=
null
)
public
AbilityElement
With
Cooldown
(
floa
t
?
value
=
null
,
floa
t
?
maxValue
=
null
)
{
if
(
value
!=
null
)
Reload
Slider
.
value
=
value
.
Value
;
if
(
value
!=
null
)
cooldown
Slider
.
value
=
value
.
Value
;
if
(
maxValue
!=
null
)
Reload
Slider
.
maxValue
=
maxValue
.
Value
;
if
(
maxValue
!=
null
)
cooldown
Slider
.
maxValue
=
maxValue
.
Value
;
return
this
;
}
}
// Start is called before the first frame update
void
Start
()
{
C
hargeSlider
=
transform
.
Find
(
"ChargeSlider"
).
GetComponent
<
Slider
>();
Reload
Slider
=
transform
.
Find
(
"ReloadSlider"
).
GetComponent
<
Slider
>();
c
hargeSlider
=
transform
.
Find
(
"ChargeSlider"
).
GetComponent
<
Slider
>();
cooldown
Slider
=
transform
.
Find
(
"ReloadSlider"
).
GetComponent
<
Slider
>();
}
// Update is called once per frame
...
...
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