HolsterAction.HasActionKey
#
Declarationpublic virtual bool HasActionKey(string actionKey)
#
ParametersName | Description |
---|---|
actionKey | Key of the action |
#
DescriptionCheck if plugin has action key
#
Usageusing NullSave.GDTK.Inventory;using System.Collections.Generic;using UnityEngine;
public class Example : MonoBehaviour{
// Check if an item can run an action public void ExampleMethod(GDTKItem target, string actionName) { // Get all ItemPlugins List<ItemPlugin> plugins = target.GetPlugins<ItemPlugin>();
// Check each plugin until a match is found foreach (ItemPlugin plugin in plugins) { if (plugin.HasActionKey(actionName)) { Debug.Log(target.info.id + " has action " + actionName); return; } }
Debug.Log(target.info.id + " does not have action " + actionName); }
}