private void Update() { if (transform.position.y < -4.0f) { Die(); } if (_respawnTime != null) { light2d.enabled = true; if (_respawnTime > 0) { _respawnTime -= Time.deltaTime; } if (_respawnTime < 0) { Respawn(); _respawnTime = null; } else if (_respawnTime < 1) { light2d.pointLightOuterRadius += Time.deltaTime * 3; PreRespawn(); } } if (_slowdown) { _rb.velocity = _rb.velocity * (1 - (3.5f * Time.deltaTime)); if (_rb.velocity.magnitude < 0.1f) { _rb.velocity = Vector2.zero; _slowdown = false; _center = true; StartCoroutine(FadeColor(light2d.gameObject, Color.cyan, 0.3f)); } } else if (_center) { transform.position = Vector2.SmoothDamp(transform.position, checkpointPosition, ref _velocity, 0.3f); if (Vector2.Distance(transform.position, checkpointPosition) < 0.001f) { _center = false; Freeze(); Show(); } } if (_dragging && !_slowdown && !_center) { Vector3 worldPosition = _camera.ScreenToWorldPoint(Input.mousePosition); Vector3 position = transform.position; if (Vector2.Distance(transform.position, worldPosition) > (lives / 10.0f)) { Vector2 dir = worldPosition - position; dir = dir.normalized * (lives / 10.0f); worldPosition = (Vector2)position + dir; } arrow.MoveArrow(worldPosition, position); _direction = position - worldPosition; } }