Class ConsumableTemplate
Abstract base class for consumable item templates, defining type, charge cost, and cooldown behavior. Provides logic for consuming items and applying cooldowns.
public abstract class ConsumableTemplate : BaseItemTemplate, ICachedObject, ITooltip
- Inheritance
-
ObjectScriptableObjectConsumableTemplate
- Implements
- Derived
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Fields
ActivationTime
The time required to activate this consumable (in seconds). A value of 0 means instant activation.
public float ActivationTime
Field Value
ChargeCost
The number of charges consumed per use.
public uint ChargeCost
Field Value
ConsumableType
The type of consumable (e.g., potion, scroll).
public ConsumableType ConsumableType
Field Value
Cooldown
The cooldown duration (in seconds) applied after consumption.
public float Cooldown
Field Value
Methods
CanConsume(IPlayerCharacter, Item, uint)
Determines if the specified character can consume the given item. Checks for valid character, item, stackable status, sufficient charges, and cooldown.
public bool CanConsume(IPlayerCharacter character, Item item, uint currentTick)
Parameters
characterIPlayerCharacterThe player character attempting to consume.
itemItemThe item to be consumed.
currentTickuintThe current network tick for cooldown evaluation.
Returns
- bool
True if the item can be consumed, false otherwise.
Invoke(IPlayerCharacter, Item, uint)
Attempts to consume the item, applying cooldown and reducing charges as needed. Destroys the item if charges are depleted.
public virtual bool Invoke(IPlayerCharacter character, Item item, uint currentTick)
Parameters
characterIPlayerCharacterThe player character consuming the item.
itemItemThe item to be consumed.
currentTickuintThe current network tick for cooldown creation.
Returns
- bool
True if the item was successfully consumed, false otherwise.