Working minigame?

This commit is contained in:
Michal Pikulski
2025-11-19 14:54:33 +01:00
parent 359e0e35bd
commit 247f7b73af
63 changed files with 8546 additions and 1463 deletions

View File

@@ -130,8 +130,9 @@ namespace UI.DragAndDrop.Core
SmoothMoveTowardPointer();
}
// Only clamp for non-overlay canvases (WorldSpace/ScreenSpaceCamera)
if (_canvas != null && _canvas.renderMode != RenderMode.ScreenSpaceOverlay)
// Only clamp when actively being dragged (prevent dragging off-screen)
// Don't clamp when just sitting idle - allow objects to move freely off-screen
if (_isDragging && _canvas != null && _canvas.renderMode != RenderMode.ScreenSpaceOverlay)
{
ClampToScreen();
}

View File

@@ -45,6 +45,10 @@ namespace UI.DragAndDrop.Core
public Vector3 WorldPosition => transform.position;
public RectTransform RectTransform => transform as RectTransform;
// Support for both UI and world-space slots
public bool IsUISlot => transform is RectTransform;
public Vector3 SlotPosition => transform.position; // Works for both Transform types
private void Start()
{
if (hideImageOnPlay)
@@ -78,6 +82,7 @@ namespace UI.DragAndDrop.Core
switch (occupantSizeMode)
{
case OccupantSizeMode.MatchSlotSize:
// Only works for UI slots with RectTransform
if (draggable.RectTransform != null && RectTransform != null)
{
Vector2 targetSize = RectTransform.sizeDelta;
@@ -85,6 +90,7 @@ namespace UI.DragAndDrop.Core
(val) => draggable.RectTransform.sizeDelta = val,
scaleTransitionDuration, 0f, Tween.EaseOutBack);
}
// World-space slots (no RectTransform) skip size matching
break;
case OccupantSizeMode.Scale: