Skip to content
Snippets Groups Projects
Commit 10754bf0 authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Added ability properties for charging.

parent cde5b976
Branches feature/inbox
No related tags found
1 merge request!56New ability fire rework. (Charging)
...@@ -61,6 +61,26 @@ namespace BigSock { ...@@ -61,6 +61,26 @@ namespace BigSock {
public float HPCost { get; protected set; } public float HPCost { get; protected set; }
/*
--------------------
Charging related properties.
--------------------
*/
/*
What kind of firetype this ability uses.
*/
public FireType FireType { get; protected set; }
/*
The minimum time in seconds the ability needs to be charged.
*/
public float MinCharge { get; protected set; } = 0.1f;
/*
The maximum time in seconds the ability before the ability is fully charged.
*/
public float MaxCharge { get; protected set; } = 0.2f;
...@@ -71,6 +91,15 @@ namespace BigSock { ...@@ -71,6 +91,15 @@ namespace BigSock {
*/ */
public bool Use(IAbilityParam par) { public bool Use(IAbilityParam par) {
var actor = par.Actor; var actor = par.Actor;
// Check the charging
if(FireType == FireType.Charge) {
// Check that we charged the minimum time.
if(par.ChargeTime < MinCharge) return false;
// Calculate how much optional charging we did.
par.ChargeTimePercent = Math.Clamp(par.ChargeTime - MinCharge / MaxCharge - MinCharge, 0f, 1f);
}
// Check that the ability is cooled down. // Check that the ability is cooled down.
if(Ready) { if(Ready) {
......
...@@ -60,6 +60,29 @@ namespace BigSock { ...@@ -60,6 +60,29 @@ namespace BigSock {
/*
--------------------
Charging related properties.
--------------------
*/
/*
What kind of firetype this ability uses.
*/
FireType FireType { get; }
/*
The minimum time in seconds the ability needs to be charged.
*/
float MinCharge { get; }
/*
The maximum time in seconds the ability before the ability is fully charged.
*/
float MaxCharge { get; }
/* /*
----------------------------- -----------------------------
Add in something for costs. Add in something for costs.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment