Attack with sword vs attack with bow

Hi,

What if the player has the option of attacking with a sword or bow based on the carrying inventory?

Should we have one attacking state (and one targeting state) with if else statements that control what should be done based on the carrying inventory (if hasSword do this, if hasBow do that)?

Or should we have multiple attacking states (AttackingSword, AttackingBow) with multiple corresponding targeting states (TargetingWithSword, TargetingWithBow)?

And which class (base state, state, player state machine…) should have a reference to the player inventory class?

Thank you

The StateMachine should always have the access to the Inventory class…

I don’t know that it’s completely necessary to create two separate attack states between Melee and Ranged. Assuming you’re using a WeaponConfig and inventory similar to the RPG course series, simply checking to see if the WeaponConfig is a ranged weapon could be used to determine if you need to fire a projectile at a certain point in the animation or let the weapon do the talking with it’s collider.

Ok thanks :+1:

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

Privacy & Terms