Class ResourceConsumableTemplate
A consumable that restores resources: a healing potion, a mana draught, a ration.
[CreateAssetMenu(fileName = "New Resource Consumable", menuName = "FishMMO/Character/Item/Consumable/Resource Consumable", order = 1)]
public class ResourceConsumableTemplate : ConsumableTemplate, ICachedObject, ITooltip
- Inheritance
-
ObjectScriptableObjectResourceConsumableTemplate
- Implements
- 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
- Extension Methods
Remarks
The first concrete consumable in the project. ConsumableTemplate and ScrollConsumableTemplate are both abstract and nothing derived from either, so no consumable item could exist at all — the charge, cooldown and destroy machinery was written and had nothing to run on.
Health goes through ICharacterDamageController.Heal rather than straight onto the attribute, so a potion behaves like every other heal in the game: it is refused on a dead character, it draws a combat number, and it counts toward healing achievements. Every other resource is a plain Gain(float), which clamps at the maximum so an overfill tops the bar up rather than pushing past full.
The base class has already taken the charge and applied the cooldown by the time this runs, so a restoration that finds no controller still consumes: the item was drunk either way.
Fields
Restores
What this restores. More than one entry restores several resources from one use.
[Tooltip("The resources this restores, and by how much.")]
public List<ResourceRestoration> Restores
Field Value
Methods
BuildTooltip(TooltipContent, bool)
Describes what drinking it gives back.
public override void BuildTooltip(TooltipContent content, bool describingInstance)
Parameters
contentTooltipContentThe content being assembled.
describingInstancebool
Invoke(IPlayerCharacter, Item, uint)
Consumes the item and restores its resources.
public override bool Invoke(IPlayerCharacter character, Item item, uint currentTick)
Parameters
characterIPlayerCharacterThe character drinking it.
itemItemThe item being consumed.
currentTickuintThe tick the use happened on.
Returns
- bool
True when the item was consumed.