RegionCombatStateAction - jimdroberts/FishMMO GitHub Wiki
RegionCombatStateAction is a region action ScriptableObject for FishMMO that enables or disables the combat state for a player character when triggered. It is used to control whether players can engage in combat within a specific region, providing dynamic gameplay rules based on location.
-
public bool EnableCombat
If true, combat is enabled for the player character; if false, combat is disabled.
-
public override void Invoke(IPlayerCharacter character, Region region, bool isReconciling)
Sets the combat state for the player character if implemented. (Currently, the logic is commented out.) Parameters: - IPlayerCharacter character: The player character whose combat state will be changed. - Region region: The region in which the action is triggered. - bool isReconciling: Indicates if the action is part of a reconciliation process. Returns: void. No exceptions are thrown.
- Create a new RegionCombatStateAction ScriptableObject via the Unity Editor (Assets > Create > FishMMO > Region > Region Combat State).
- Set the EnableCombat field in the inspector to true or false as needed for your region.
- Attach the RegionCombatStateAction to a region definition or trigger as appropriate.
// Example 1: Assigning combat state to a region action
// 1. Create a new RegionCombatStateAction asset in the Unity Editor.
// 2. Set EnableCombat to true or false in the inspector.
// 3. Reference this asset in your region setup.
// Example 2: Triggering the action in code
// This is typically handled by the region system, but can be invoked manually for testing.
regionCombatStateAction.Invoke(playerCharacter, region, false);
- Ensure the character and their CombatController are not null before attempting to set combat state.
- Use this action to clearly define combat and non-combat zones for better gameplay flow.
- Document the intended combat rules for each region to avoid confusion during development.