private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player") && (player.GetPlayerState() == ObjectWithFlick.PlayerState.PLAYER_STATE_JUMP_DOWN || (player.GetPlayerState() == ObjectWithFlick.PlayerState.PLAYER_STATE_JUMP_UP && player.GetPlayerOldState() == ObjectWithFlick.PlayerState.PLAYER_STATE_TAP))) { player.SetIfOnBlock(true); player.SetPlayerState(ObjectWithFlick.PlayerState.PLAYER_STATE_IDLE); playerRb.velocity = Vector3.zero; playerRb.angularVelocity = 0f; } }
// Drag private void OnDragStart() { isDragging = true; player.DisactivateRb(unlimitedJump); startPoint = cam.ScreenToWorldPoint(Input.mousePosition); endPoint = startPoint; distance = Vector2.Distance(startPoint, endPoint); direction = (startPoint - endPoint).normalized; force = direction * distance * pushForce; player.SetPlayerState(ObjectWithFlick.PlayerState.PLAYER_STATE_TAP); trajectory.UpdateDots(player.pos, force); trajectory.Show(); }