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

Added some get only properties to AbilityEntity.

parent 2c630230
No related branches found
No related tags found
1 merge request!84Merge, ability cluster
......@@ -18,13 +18,26 @@ namespace BigSock {
public int Index { get; }
// The time this ability started charging.
public float ChargeStarted { get; }
public float ChargeStarted { get; set; }
// The keys bound to this ability.
public List<KeyCode> Keys { get; set; }
public List<KeyCode> Keys { get; }
// 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 && ChargeStarted > 0)
? 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));
......
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