PlayerControl FixedUpdate¶
What's contained here is miscellaneous updates, but there's one of 3 update types that can happen here (the first one is chosen):
startdigis true while the player isn't in asubmarinemeaning thediggingstate needs to be updated- The player is in a
submarineand entity.modelexists meaning thesubmarinestate needs to be updated - Neither of the cases above applies meaning the entity.
spritelocal position needs to be progressively restored
digging update¶
- entity.
spritelocal y position is lerped from the existing one to -2.0 with a factor of 0.03 lockkeysis set to true if the player isn't fullydiggingyet and to false if it is. This essentially locks most inputs processing fromstartdigto fullydigging- If entity.
spritelocal y position reached -1.5 or lower:diggingis set to true
- Otherwise (still in
startdig):- StopMoving called on the entity with its current animstate as the targetstate
- If no sound is playing on entity.
sound:- If the player is fully
digging, theDiggingsound is played on loop on the entity with a volume of 0.8
- If the player is fully
- Otherwise (a sound is already playing on entity.
sound):- entity.
sound.pitch is set to a value that depends ondelta.magnitude (meaning if there's enough movement):- > 0.1: 1.1 pitch
- \<= 0.1: 0.95 pitch
- entity.
submarine update¶
- If we're not in instance.
inevent, entity.emoticonoffsetis set to Vector3.up - The entity gets some adjustements:
flipis set to falseoverrideflipset to truespriteangles zeroed outspritescale set to Vector3.zeromodellocal y position set to a lerp from the existing one to Sin(Time.time * 3.0) * 0.15 (unlessdiggingis true where it's -0.5 instead) with a factor of 0.05model.extra[1](the telescope) local position is set to (0.575, 0.0,Z) whereZis determined by a lerp from the existing local z position to 0.5 (4.0 instead ifdiggingis true) with a factor of 0.025 (0.5 is actually the normal position of where the telescope should be)model.extra[0](the propeller) is set to rotate in x by 15.0 * entity.rigidvelocity magnitudemodelangles are updated:- x: Always -90.0
- y: LerpAngle from the existing y angle to entity.
detecty angle - 90.0 with a factor of 0.1 (1.0 instead if instance.inevent). Essentially, it aligns the y angles to where the player is heading with a bit of delay unless we are instance.ineventwhere it instantly aligns - z: Sin(Time.time * 3.0) * (entity.
rigidvelocity magnitude / 2.0) which makes the submarine wave slightly periodically
entity.sprite local position restore¶
The only thing that happens in this update is the entity.sprite local position is lerped from the existing one to Vector3.zero with a factor of 0.17.