Interface IStackable<T>
Interface for objects that can be stacked together, such as items or resources. Provides methods for stack management and splitting.
public interface IStackable<T>
Type Parameters
TThe type of object that can be stacked.
Methods
AddToStack(T)
Adds the specified object to the current stack if possible.
bool AddToStack(T other)
Parameters
otherTThe object to add to the stack.
Returns
- bool
True if the object was successfully added, false otherwise.
CanAddToStack(T)
Determines if the specified object can be added to the current stack.
bool CanAddToStack(T other)
Parameters
otherTThe object to check for stack compatibility.
Returns
- bool
True if the object can be added to the stack, false otherwise.
TryUnstack(uint, out T)
Attempts to remove a specified amount from the stack, returning the split stack if successful.
bool TryUnstack(uint amount, out T stack)
Parameters
amountuintThe amount to unstack.
stackTThe resulting stack after unstacking.
Returns
- bool
True if the unstack operation was successful, false otherwise.