Help With RPG Abilities extention

Hello. In my RPG project, I am planning to have many abilities. For instance, right now I am trying to implement an ability in which the player “roars” and then temporarily with each successful hit on an enemy his attack speed and damage increase. So I am wondering… can I make a use of the Finished function for that? Right now I have another MONO script on the player which has a bool isUsingRoarAbility. So the effect strategy of this ability gets the script component and sets this bool to true and then on the MONO script handles the actual ability effects (increase damage and attack speed with each hit). I am not sure if that’s a good way because later when I add abilities that damage the enemy periodically after the ability (poison arrow) if I handle it on a MONO script on the enemy then I guess many problems can occur like more than 1 player hitting the same enemy with the same ability (so the damage won’t stack because the poison damage will be handled on the enemy MONO script which only checks for a bool)

I suspect I answered this question on another of our forums.

With respect to both the Roar Ability and the Poison , I feel using a MonoBehaviour to handle continuing effects is the best way to go. The Ability itself locates the appropriate component on the target and activates the abilility or applies the effect.
In terms of effects stacking, I recommend making an inner class, something like

private class AppliedEffect
{
    public float TimeRemaining;
    public float Amount;
}

Then you can use a List<AppliedEffect> to track multiple effects and reduce the duration each frame.
When you need the effect amount, simply iterate over all of the AppliedEffects to get the total amount of poision/buff applied.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms