Files
JuegoSim/Assets/_Project/Scripts/Code/InteractionLayer/Interactables/GrabInteractable.cs
T
2026-07-21 08:56:10 +03:00

32 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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>();
}