EnemyFlee¶
A coroutine mode for enemy actions to have an enemy party member flee the battle. This will set their fled to true and enemyfled to true alongside an animation to move them offscreen.
The coroutine should be stored in tryenemyheal as it will be set to null when completed so the caller can yield on it.
private IEnumerator EnemyFlee(int walkstate, bool afterimage, int enemyid)
Parameters¶
walkstate: The animstate to use when the enemy party memberafterimage: Whether or not to enable the enemy party member'strailduring the moveenemyid: Theenemydataindex of the enemy party member that will flee
Procedure¶
Scuttle2sound plays on loop usingsounds[9]- animstate set to the sent walkstate
flipset to true- Jump called
- Yield for 0.4 seconds
sounds[9]pitch set to 1.25- Yield all frames until the enemy party member's
ongroundis true - The enemy party member's
trailset to afterimage Fleesound playssounds[9]stop with 0.001 delay- Over the course of 50.0 frames, the enemy party member's position changes to offscreen at (15.0, 0.0, 0.0) via a lerp. Before each frame yield, the animstate is set to the sent walkstate
- The enemy party member's
fledset to true tryenemyhealset to null informing the caller that the coroutine completedenemyfledset to truesounds[9]stop with 1.0 delay