private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Danger") { Destroy(gameObject); PlayerUtility.setAttemptText(txt, AttemptsTracker.incrementAndGetAttemptLevelTwo()); SceneManager.LoadScene(3); } }
void Update() { if (onGround) { PlayerUtility.PlayerAction(body2D, RUNNING_VELOCITY, NO_VELOCITY); PlayerUtility.ChangeAnimation(animator, RUNNING_ANIMATION); } if (PlayerUtility.CanJump(onGround, Input.GetKey(SPACE))) { PlayerUtility.PlayerAction(body2D, RUNNING_VELOCITY, JUMPING_VELOCITY); body2D.AddForce((Vector2.right * RUNNING_VELOCITY) * THRUST); } if (player.transform.position.x >= FINISH_LOCATION_X_AXIS) { PlayerUtility.PlayerAction(body2D, NO_VELOCITY, NO_VELOCITY); PlayerUtility.ChangeAnimation(animator, IDLE_ANIMATION); txt.text = LEVEL_COMPLETE_MESSAGE; AttemptsTracker.setAttemptLevelTwoToZero(); } }
void Start() { PlayerUtility.setAttemptText(txt, AttemptsTracker.getAttemptLevelTwo()); }