32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using UnityEngine;
|
||
|
||
/// <summary>
|
||
/// Data/configuration component placed on block prefabs.
|
||
/// Stores per-prefab drag settings so GhostManager can read them at instantiation time.
|
||
/// All drag, snap, and placement logic has moved to GhostManager.
|
||
/// </summary>
|
||
public class GrabInteractable : MonoBehaviour
|
||
{
|
||
[Header("Attachment")]
|
||
[SerializeField] private Transform attachPoint;
|
||
|
||
[Header("Surface Alignment")]
|
||
public bool alignToSurfaceNormal = true;
|
||
public float alignmentSpeed = 15f;
|
||
public bool snapRotation = false;
|
||
|
||
[Header("Movement")]
|
||
public float followSpeed = 20f;
|
||
public float heightOffset = 0f;
|
||
|
||
[Header("Validation & Visuals")]
|
||
[SerializeField] private IValidator validator;
|
||
public Color validTint = new Color(0.5f, 1.0f, 0.5f, 1.0f);
|
||
public Color invalidTint = new Color(1.0f, 0.5f, 0.5f, 1.0f);
|
||
|
||
/// <summary>Returns the designated attach/pivot point, or this transform if none is set.</summary>
|
||
public Transform GetAttachPoint() => attachPoint;
|
||
|
||
/// <summary>Returns the PlacementValidator – checks the component on this GameObject as fallback.</summary>
|
||
public IValidator GetValidator() => validator != null ? validator : GetComponent<IValidator>();
|
||
} |