Attack Sequence Diagram - UQdeco2800/2022-studio-2 GitHub Wiki

Attack Sequence Diagram

Please Note: this sequence diagram was created at the beginning of the sprint to inform the improvement of our function. The attackEnemy() function has since been re-worked for simplicity reasons. See: https://github.com/UQdeco2800/2022-studio-2/wiki/Re-structure-of-attackEnemy-function

Below is the UML sequence diagram for when the user tries to make the player attack.

  1. The spacebar is pressed, which then calls the attackEnemy() method in PlayerTouchAttackComponent.
  2. The method then starts checking if the player can start an attack instance by checking if the attack cooldown is over. This is not included in the sequence diagram below as this is not too relevant to the attack method and will further convolute the diagram.
  3. The current weapon equipped and the current aura applies is then extracted.
  4. If the current weapon is not null, the cooldown time is set.
    • If the aura applied is not null, the weapon animation of the player is set as the buffed weapon animation.
    • Else, the weapon animation on the player is the default weapon animation.
  5. Else (the current weapon is null), the cooldown time is set as 4 seconds, which is the attack cooldown of the player without a weapon.
  6. Then, the class checks the type of the non-ranged weapon (or if there is none), and plays the weapon sound accordingly.
  7. After that, if the player collides with an enemy, the specified damage gets applied to the enemy. How the damage is extracted is not included in the sequence diagram.
  8. If the weapon is a ranged weapon, the ranged attack sound is played, and a plunger bow projectile is spawned at the game area.

attack sequence

Back to Combat Items Contents Page

Author

  • Eugene Chong
  • GitHub: @eugene2341
  • Discord: gene#0005
  • Slack: Eugene Chong