Code Detail (Combo System)
For combo system of Twilight Soldier Dusk, a combination of linked list and map is used to achieve the combo system. The reason I've chose to use these methods is because each attack have different branch that can be chained to such as Light Attack, Heavy Attack etc. The map in each attack can store all the possible branches according to their type and the attack can be chained based on the player input.


Branch Initial Visualisation

Combo Attack Class
The combo attack class have variables that stores attack name which will be used to play animation of that attack, type of attack (light or heavy etc), type of combo (sword, hammer, spear) and also contains a branch map of possible attack that can be chained. Damage and play rate is also included initially for easier customization purpose but it is not used in the final build of the game.
​


Functions Example
Add child attack function will add the given attack into the map branch of current attack based on what attack type it is. The get child attack function will retrieve attacks of the chosen attack type from current attack branches if it is existing. Otherwise it will return a null pointer.


The attacks itself will be created when the character first spawn. After the attacks is created, the attacks will be linked using the function created in the combo attack node.


Attack Functions
The attack functions will retrieve the attack type chosen from the branches of current attack. If the attack exist, the next attack pointer will be replaced with the attack else it will remain as a null pointer.


Function to Play Animations
The play next attack function will be called each time when updating. The function will stop if the next attack pointer is empty or there are other attack animation is still playing. If it is playable, it will check the attack type of the next attack. If the attack is light or heavy attack, it will play the chosen attack animation using PlayAnimMontage function. It will then set current attack to the attack chosen. The next attack pointer will be reset to null instead. If the attacks is switch attacks, the function will check if it is left or right switch. The weapon switching can be handled using integer calculations as the weapon type is an Enum. This can also modularise the weapon switching. After that, the function will check if currently player is attacking or is idling. It will switch the character weapon and play the switch attack if its the former while will switch the weapon only if its the latter. After playing the switch attack, the combo chain is reset to the switched weapon root attack.
​
This ends my code details of combo system for the project, Twilight Soldier : Dusk.