Dig¶
A coroutine made for enemy actions to have the enemy dig and change its position to Underground.
The coroutine should be stored in checkingdead as it will be set to null when completed so the caller can yield on it.
private IEnumerator Dig(int enemyid, int jump)
There is an overload available that sends 1 as the jump and relays the enemyid where it sets checkingdead to a new coroutine being the one above followed by a frame yield:
private IEnumerator Dig(int enemyid)
Parameters¶
enemyid: Theenemydataindex of the enemy party member that will be diggingjump: The amount of jump the enemy party member will do before digging
Procedure¶
- Done jump amount of times:
- Jump called on the enemy party member
Jumpsound plays- Yield for 0.5 seconds
- Yield all frames until the enemy party member's
ongroundis true
Digsound plays- The enemy party member's
diggingis set to true - Yield all frames until the enemy party member's
digtimebecomes 29.0 or above - Yield for 0.25 seconds
- The enemy party member's position is set to
Underground checkingdeadis set null indicating the caller that the coroutine completed