-
Notifications
You must be signed in to change notification settings - Fork 1
Attack Sequence Diagram
Lachlan Benson edited this page Oct 17, 2022
·
8 revisions
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.
- The spacebar is pressed, which then calls the
attackEnemy()
method inPlayerTouchAttackComponent
. - 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.
- The current weapon equipped and the current aura applies is then extracted.
- 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.
- 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.
- Then, the class checks the type of the non-ranged weapon (or if there is none), and plays the weapon sound accordingly.
- 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.
- If the weapon is a ranged weapon, the ranged attack sound is played, and a plunger bow projectile is spawned at the game area.
Back to Combat Items Contents Page
- Eugene Chong
- GitHub: @eugene2341
- Discord: gene#0005
- Slack: Eugene Chong