WeaponTemplate - jimdroberts/FishMMO GitHub Wiki

Description

ScriptableObject template for weapon items, defining attack power and attack speed attributes. Inherits from EquippableItemTemplate for equipment logic.


API Access

Fields

  • public ItemAttributeTemplate AttackPower

    The attribute template representing the attack power provided by this weapon.

  • public ItemAttributeTemplate AttackSpeed

    The attribute template representing the attack speed provided by this weapon.


Basic Usage

Setup

  1. Create a new WeaponTemplate asset via the Unity Editor (Assets > Create > FishMMO > Item > Weapon).
  2. Assign ItemAttributeTemplate assets to the AttackPower and AttackSpeed fields to define the weapon's effects.
  3. Reference the WeaponTemplate in item or equipment systems as needed.

Example

// Example 1: Accessing weapon attributes from a template
WeaponTemplate weapon = ...; // Reference to the weapon template
ItemAttributeTemplate power = weapon.AttackPower;
ItemAttributeTemplate speed = weapon.AttackSpeed;
if (power != null && speed != null) {
    // Use the weapon's attributes
}

Best Practices

  • Assign relevant ItemAttributeTemplate assets to the AttackPower and AttackSpeed fields for each weapon item.
  • Use descriptive asset names for clarity and maintainability.
  • Document the purpose and effect of each weapon attribute in the asset's Inspector description.
⚠️ **GitHub.com Fallback** ⚠️