void Update() { switch (state) { case State.AboutToJump: if ((jumpPoint.x - transform.position.x) * xVelocity <= 0) { rigidBody.AddForce(new Vector3(0, JUMP_INIT_VELOCITY, 0), ForceMode.VelocityChange); animator.OnJumpStart(); state = State.Jumping; } break; case State.Jumping: if (rigidBody.velocity.y < 0) { animator.OnJumpMaximumHeightReached(); state = State.Falling; } break; case State.Landed: if (IsOffScreen() && xVelocity * transform.position.x > 0) { if (ballGrabbed) { ballGrabbed = false; GameState.instance.OnBallLost(); BallController.instance.Reset(); } Disable(); } break; } }
void Update() { antura.IsAngry = angry; antura.SetWalkingSpeed(walkSpeed); if (doTransition) { doTransition = false; antura.State = targetState; } if (doBurp) { doBurp = false; antura.DoBurp(); } if (doBite) { doBite = false; antura.DoBite(); } if (doShout) { doShout = false; antura.DoShout(); } if (doSniff) { doSniff = false; antura.DoSniff(); } if (onJumpStart) { onJumpStart = false; antura.OnJumpStart(); } if (onJumpMiddle) { onJumpMiddle = false; antura.OnJumpMaximumHeightReached(); } if (onJumpGrab) { onJumpGrab = false; antura.OnJumpGrab(); } if (onJumpEnd) { onJumpEnd = false; antura.OnJumpEnded(); } if (doCharge) { doCharge = false; antura.DoCharge(null); } if (doSpitOpen) { doSpitOpen = false; antura.DoSpit(true); } if (doSpitClosed) { doSpitClosed = false; antura.DoSpit(false); } if (onSlipStart) { onSlipStart = false; antura.OnSlipStarted(); } if (onSlipEnd) { onSlipEnd = false; antura.OnSlipEnded(); } }