void Jump(Collider2D step) { var stepIndex = int.Parse(step.gameObject.name); JumpVelocity = gravity * (gameManager.isStar ? 30f : 26f); rb.velocity = new Vector2(0, JumpVelocity); playerAnimator.Play("Character@Jump", 0, 0f); Effect(step); Destroy(step.gameObject); var addStep = stepIndex - lastJumpStepIndex; for (int i = 0; addStep > i; i++) { stepManager.MakeNewStep(); } IncreaseGravity(); gameManager.AddScore(1); source.PlayOneShot(JumpClip, 1); lastJumpStepIndex = int.Parse(step.gameObject.name); }
void DestroyAndCreateNewStep(Collider2D step) { Destroy(step.gameObject); stepManager.MakeNewStep(); }