NewEnemy¶
This coroutine is a wrapper around AddNewEnemy in syntax (1) that ends up doing more spawn logic after.
private IEnumerator NewEnemy(int id, Vector3 pos, SpawnAnim animation)
Parameters¶
id: The enemy id to addposition: Where the enemy should initialy be spawnedanimation: If it's notNone(1 or 2), the spawn animation to use for the new enemy. If it'sNone(0), the coroutine only calls AddNewEnemy and setcheckingdeadto null
Procedure¶
AddNewEnemy is called with the id and position and store the entity locally.
If animation is None (0), the coroutine is done as it only sets checkingdead to null before ending
Otherwise, the following occurs (the entity refered to is the new enemy just added):
- The
Chargesound is played - If entity.
cotunknownis true:- ForceCOT is called on the entity
spritebasecoloris set to be pure black at 50% opacity
- The entity local scale is zeroed out
spinis set to (0.0, 25.0, 0.0)- During the course of 60.0 frames tracked with a local frame counter (incremented by the game's frametime):
- entity.animstate is set to 11 (
Hurt) - entity's local scale is set to a lerp from Vector3.zero to a target that depends on the animation with a factor of the ratio of the amount of frames cumulated over 60.0 frames. The target is Vector3.one for an animation of
Seed(1) and (0.75, 0.75, 0.75) forSeedMini(2) - The local framecounter is advanced
- A frame is yielded
- entity.animstate is set to 11 (
startscaleis set to Vector3.onespritelocal scale is set to the same target used for the lerping abovespinis zeroed out- animstate is set to 0 (
Idle) - If animation is
SeedMini(2),hpbarlocal scale is increased by (0.25, 0.25, 0.25) tempslotis set to the lastenemydatacheckingdeadis set to null and the coroutine ends