FactionTemplate - jimdroberts/FishMMO GitHub Wiki
Defines a ScriptableObject representing a single faction, including its icon, description, and default relationships (allied, neutral, hostile) with other factions. Used for reputation, standing, and UI display in FishMMO.
-
public Sprite Icon
The icon representing this faction in the UI.
-
public const int Minimum
The minimum possible value for faction reputation or standing.
-
public const int Maximum
The maximum possible value for faction reputation or standing.
-
public string Description
Description of the faction, used for tooltips and UI.
-
public FactionHashSet DefaultAllied
Set of factions that are considered allied by default.
-
public FactionHashSet DefaultNeutral
Set of factions that are considered neutral by default.
-
public FactionHashSet DefaultHostile
Set of factions that are considered hostile by default.
-
public string Name
The display name of the faction (from the ScriptableObject's name).
- Create a new FactionTemplate ScriptableObject in your project.
- Assign an icon and description for the faction.
- Use the DefaultAllied, DefaultNeutral, and DefaultHostile sets to define relationships with other factions.
// Example 1: Creating a new faction in the Unity Editor
// 1. In the Unity Editor, create a new FactionTemplate asset.
// 2. Assign an icon and description.
// 3. Add other FactionTemplate assets to DefaultAllied, DefaultNeutral, and DefaultHostile as needed.
// Example 2: Accessing faction data in code
var faction = Resources.Load<FactionTemplate>("Path/To/Faction");
Debug.Log(faction.Name);
Debug.Log(faction.Description);
- Use the DefaultAllied, DefaultNeutral, and DefaultHostile sets to clearly define relationships for each faction.
- Keep the icon and description up to date for accurate UI representation.
- Use the Minimum and Maximum constants to clamp reputation or standing values in your game logic.