luna icon indicating copy to clipboard operation
luna copied to clipboard

WalkingQueue redesign

Open notjuanortiz opened this issue 5 years ago • 2 comments

notjuanortiz avatar Dec 04 '19 14:12 notjuanortiz

The WalkingQueue class does not test well due to the level of cognitive complexity of many methods within the class, which breaks a few SOLID principles.

A redesign of the class is necessary if we want to extend the functionality of mobile entities, without introducing more unstable code.

The current functionalities encompassed within this class include:

  • Determine the walking direction
  • Determine the running direction
  • Calculating run-energy depletion based on a player's weight
  • Calculating run-energy regeneration based on a player's agility level
  • Monitoring a player's run-energy
  • Prevents movement (incompleted)

notjuanortiz avatar Dec 05 '19 04:12 notjuanortiz

To differentiate between walking and running, the best approach IMO would be to make use of the State Object design pattern. This also allows us to easily implement other movement states, such as Stunned, Frozen, and Snared, without having to modifying existing states (in theory).

notjuanortiz avatar Dec 08 '19 19:12 notjuanortiz