WeaponTemplate - jimdroberts/FishMMO GitHub Wiki
ScriptableObject template for weapon items, defining attack power and attack speed attributes. Inherits from EquippableItemTemplate for equipment logic.
-
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.
- Create a new WeaponTemplate asset via the Unity Editor (Assets > Create > FishMMO > Item > Weapon).
- Assign ItemAttributeTemplate assets to the AttackPower and AttackSpeed fields to define the weapon's effects.
- Reference the WeaponTemplate in item or equipment systems as needed.
// 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
}
- 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.