Production
Key features
Manages Player Production: Tracks and updates all components implementing
IProduce
on player units.Realtime & Manual Production: Supports both real-time automatic production and manual updates (ideal for turn-based systems).
Configurable Production Tick Rate: Adjustable interval (
tickInterval
) for real-time production updates.Delegate for Production Rules: Can automatically validate production processes based on population, resources, and requirements or allow custom validation logic.
Integration with Other Modules: Works alongside
ResourceModule
andPopulationModule
to ensure produced entities do not overflow population or resource storage.
Structure
Production Module - Manages production, automatically or manually, realtime or turn based.
Active Production Capability - Defines production options, produce per request.
Passive Resource Production Capability - Defines passive resource production.
Active Production - Provides production behaviour on a game object.
Passive Resource Production - Provides production behaviour on a game object.
Production Events - Global events invoked for use like UI updates
Usage examples
Enabling Manual Production
Manually updating production for cases like turn base games.
Using Realtime Production
By default, if ProduceManually
is false, the module runs automatically based on tickInterval
.
Disable Built-in validation
To disable the built-in validation delegate handling on Production Module, set the definesProductionDelegate to false
.
Assigning a Custom Production Delegate
To assign custom delegate to units, first you must disable the built-in validation on the Module, they you can assign the delegate to each unit specifically:
Where CustomProductionDelegate
implements IActiveProductionDelegate
.
Access Production Actions
To retrieve actions defined on the unit for it's production can be done through base implementation, however you can implement your own production capability with ActiveProductionCapability
interface.
Define Custom Actions
To replace default production actions create new structure for defining your own action interface, create new production unit capability and then remove the existing capability on unit (if used) and add the new CustomProductionCapability
.
Manage production
To start production on a unit that supports it, you should use StartProduction
method.
Or cancel the production and receive a list of resources that need to be freed duo to cancellation.
Last updated