From 0c469099b5b947b1e5becf0a8575581aa2aa15b7 Mon Sep 17 00:00:00 2001 From: Ny Bruker <robinhs@stud.ntnu.no> Date: Sat, 29 Oct 2022 19:11:14 +0200 Subject: [PATCH] Made abilities use IAbilityParam instead. --- MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs | 8 +++++--- MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs index 72ff08e6..a652d433 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs @@ -69,7 +69,9 @@ namespace BigSock { Handles cooldown and ability cost here. Returns true if the ability was successfully used. */ - public bool Use(Character actor, Vector3? target = null) { + public bool Use(IAbilityParam par) { + var actor = par.Actor; + // Check that the ability is cooled down. if(Ready) { //> Handle checking costs here. @@ -78,7 +80,7 @@ namespace BigSock { if(HPCost > 0f && actor.HP < HPCost) return false; // Activate the ability. - var res = Activate(actor, target); + var res = Activate(par); // If it succeeded, update cooldown and pay ability cost. if(res) { @@ -102,7 +104,7 @@ namespace BigSock { - Even if nothing was hit, used to indicate that cooldowns should be updated. This should be overridden in sub-classes for the actual abilities. */ - protected abstract bool Activate(Character actor, Vector3? target); + protected abstract bool Activate(IAbilityParam par); diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs index 5751ef5b..99cdd8be 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs @@ -75,7 +75,7 @@ namespace BigSock { /* Try to use the ability. */ - bool Use(Character actor, Vector3? target); + bool Use(IAbilityParam par); /* Returns text that represents info about the ability. -- GitLab