diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs index a652d433eb4271d05740f2d25a5a6df6a8f2a482..5a788ea1ddd59ef06c4e8683da2cc229b58804fa 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs @@ -61,6 +61,26 @@ namespace BigSock { 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 { */ public bool Use(IAbilityParam par) { 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. if(Ready) { diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs index 99cdd8be4802e1dc6c659749aa756838bba06c73..e746fa82e6e644cc5b933e853ca0661da79ec52b 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs @@ -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.