MerchantTemplate - jimdroberts/FishMMO GitHub Wiki
Defines a ScriptableObject representing a merchant, including icon, description, abilities, ability events, and items for sale. Used for merchant NPCs and shop systems in FishMMO.
-
public Sprite icon
The icon representing this merchant in the UI.
-
public string Description
Description of the merchant, used for tooltips and UI.
-
public List Abilities
List of abilities that this merchant can offer or use.
-
public List AbilityEvents
List of ability events associated with this merchant (e.g., triggers for special actions).
-
public List Items
List of items available for sale by this merchant.
-
public string Name { get; }
The display name of the merchant (from the ScriptableObject's name).
-
public Sprite Icon { get; }
The icon representing this merchant in the UI (property accessor).
- Create a new MerchantTemplate ScriptableObject in your project.
- Assign an icon, description, abilities, ability events, and items for sale.
- Reference the MerchantTemplate in merchant NPCs or shop systems.
// Example 1: Creating a new merchant in the Unity Editor
// 1. In the Unity Editor, create a new MerchantTemplate asset.
// 2. Assign an icon, description, abilities, ability events, and items for sale.
// Example 2: Accessing merchant data in code
var merchant = Resources.Load<MerchantTemplate>("Path/To/Merchant");
Debug.Log(merchant.Name);
Debug.Log(merchant.Description);
foreach (var item in merchant.Items) {
Debug.Log(item.Name);
}
- Keep the icon and description up to date for accurate UI representation.
- Use the Abilities and AbilityEvents lists to define special merchant behaviors.
- Populate the Items list with all items the merchant can sell.
- Reference MerchantTemplate assets in merchant NPCs or shop systems for consistency.