Update¶
This is the Update of EntityControl. It doesn't do as much as LateUpdate
- Check if the entity should receive updates which only happens when unpaused, minipause isn't active, the message lock is released and the entity isn't dead. This can be overriden with
activeonpause
- Follow the standard animation speed update logic unless
overrideanimspeed
is true which will set the animation speed to 1.0 if there's noicecube
and to 0.0 if there is one on top of forcing the animstate toHurt
- Make sure the
sprite
is disabled if this is the player entity and is a submarine, otherwise- Toggle the sprite being enabled if the
icooldown
hasn't expired yet and the player is free (meaning it is present, no minipause or pause, not in an event, the message lock is released, and the player isn't digging) - Ensure the sprite is enabled if it's not an item and it has no
npcdata
or it has one and it doesn't have adisguiseobj
- Ensure the child of the sprite are enabled or disabled according to the main sprite's enabled unless the
npcdata
is present and itstrapped
is true
- Toggle the sprite being enabled if the
- Decrease the
icooldown
with the framestep - Handle the restore of the entity when unpausing happend:
- The
rigid
's useGravity is set tolastgravity
- The
sound
's volume is set tolastvolume
- The
rigid
's velocity is set tolastvelocity
lastvelocity
andpausepos
are put back to null
- The
- Follow the standard animation speed update logic unless
- Handle pausing updates, if we are paused
- Unless
lastvelocity
already had a value (which means this is the first frame of being paused) the pause states are savedpausepos
is set to thetransform
's positionlastgravity
is set to therigid
's useGravitylastvolume
is set tosound
's volumelastvelocity
is set to therigid
's velocity- gravity is disabled on the
rigid
- The
sound
is muted - The
rigid
's velocity is zeroed
- If not in a battle, ensure the animation speed is set to 0.0 and then call StopMoving with the current animstate which will zero the
rigid
's velocity and thedeltavelocity
. Otherwise, ensure the animation speed is 1.0
- Unless