39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// Placeable behavior for building/placing items.
|
|
/// </summary>
|
|
[CreateAssetMenu(menuName = "Items/Behaviors/Placeable Behavior")]
|
|
public class PlaceableBehavior : ItemBehavior
|
|
{
|
|
[Header("Placement Settings")]
|
|
[SerializeField] private GameObject placeablePrefab;
|
|
|
|
public override bool IsConsumable => true;
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (string.IsNullOrEmpty(behaviorName)) behaviorName = "Place";
|
|
if (string.IsNullOrEmpty(animTrigger)) animTrigger = "Place";
|
|
canRepeat = false;
|
|
}
|
|
|
|
public override bool CanUse(GameObject user, GameObject target)
|
|
{
|
|
// Would integrate with BuildManager for placement validation
|
|
return placeablePrefab != null;
|
|
}
|
|
|
|
public override void Use(GameObject user, GameObject target)
|
|
{
|
|
// Actual placement would be handled by BuildManager
|
|
// This is a placeholder for the behavior pattern
|
|
Debug.Log($"[PlaceableBehavior] Would place {placeablePrefab?.name}");
|
|
}
|
|
|
|
public override string GetBlockedReason(GameObject user, GameObject target)
|
|
{
|
|
if (placeablePrefab == null) return "Invalid placement item";
|
|
return null;
|
|
}
|
|
} |