코드 리팩토링
재사용성 및 확장성을 고려하여 코드 전반을 리팩토링함
This commit is contained in:
63
Assets/Scripts/Items/IUsableItem.cs
Normal file
63
Assets/Scripts/Items/IUsableItem.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for items that can be used/activated by the player.
|
||||
/// </summary>
|
||||
public interface IUsableItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Check if the item can be used.
|
||||
/// </summary>
|
||||
/// <param name="user">The GameObject using the item (player)</param>
|
||||
/// <param name="target">Optional target for the use action</param>
|
||||
/// <returns>True if the item can be used</returns>
|
||||
bool CanUse(GameObject user, GameObject target);
|
||||
|
||||
/// <summary>
|
||||
/// Use the item.
|
||||
/// </summary>
|
||||
/// <param name="user">The GameObject using the item (player)</param>
|
||||
/// <param name="target">Optional target for the use action</param>
|
||||
void Use(GameObject user, GameObject target);
|
||||
|
||||
/// <summary>
|
||||
/// Get the action descriptor for using this item.
|
||||
/// </summary>
|
||||
ActionDescriptor GetUseAction();
|
||||
|
||||
/// <summary>
|
||||
/// Whether using this item consumes it (reduces stack count).
|
||||
/// </summary>
|
||||
bool IsConsumable { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interface for items that can be equipped on the player.
|
||||
/// </summary>
|
||||
public interface IEquippableItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the equipment prefab to spawn.
|
||||
/// </summary>
|
||||
GameObject GetEquipmentPrefab();
|
||||
|
||||
/// <summary>
|
||||
/// Get position offset for equipment placement.
|
||||
/// </summary>
|
||||
Vector3 GetPositionOffset();
|
||||
|
||||
/// <summary>
|
||||
/// Get rotation offset for equipment placement.
|
||||
/// </summary>
|
||||
Vector3 GetRotationOffset();
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of the attachment point on the character.
|
||||
/// </summary>
|
||||
string GetAttachmentPointName();
|
||||
|
||||
/// <summary>
|
||||
/// Find the attachment point transform on a user.
|
||||
/// </summary>
|
||||
Transform FindAttachmentPoint(GameObject user);
|
||||
}
|
||||
Reference in New Issue
Block a user