Class ProductConsumptionProfileBuilder
Builds an immutable intrinsic consumption profile for custom products.
public sealed class ProductConsumptionProfileBuilder
- Inheritance
-
ProductConsumptionProfileBuilder
- Inherited Members
- Extension Methods
Constructors
ProductConsumptionProfileBuilder()
public ProductConsumptionProfileBuilder()
Methods
Build()
Builds the configured immutable consumption profile.
public ProductConsumptionProfile Build()
Returns
- ProductConsumptionProfile
The immutable consumption profile.
Exceptions
- InvalidOperationException
Thrown when provider compatibility or at least one lifecycle callback was not configured.
OnNpcApply(Action<ProductConsumptionContext>)
Sets behavior to run after ordinary effects apply to an NPC consumer.
public ProductConsumptionProfileBuilder OnNpcApply(Action<ProductConsumptionContext> callback)
Parameters
callbackAction<ProductConsumptionContext>The callback to run for the NPC consumer.
Returns
- ProductConsumptionProfileBuilder
This builder for method chaining.
OnNpcClear(Action<ProductConsumptionContext>)
Sets behavior to run after ordinary effects clear from an NPC consumer.
public ProductConsumptionProfileBuilder OnNpcClear(Action<ProductConsumptionContext> callback)
Parameters
callbackAction<ProductConsumptionContext>The callback to run for the NPC consumer.
Returns
- ProductConsumptionProfileBuilder
This builder for method chaining.
OnPlayerApply(Action<ProductConsumptionContext>)
Sets behavior to run after ordinary effects apply to the local consuming player.
public ProductConsumptionProfileBuilder OnPlayerApply(Action<ProductConsumptionContext> callback)
Parameters
callbackAction<ProductConsumptionContext>The callback to run for the local player.
Returns
- ProductConsumptionProfileBuilder
This builder for method chaining.
OnPlayerClear(Action<ProductConsumptionContext>)
Sets behavior to run after ordinary effects clear from the local consuming player.
public ProductConsumptionProfileBuilder OnPlayerClear(Action<ProductConsumptionContext> callback)
Parameters
callbackAction<ProductConsumptionContext>The callback to run for the local player.
Returns
- ProductConsumptionProfileBuilder
This builder for method chaining.
WithProviderCompatibility(string, int)
Sets the stable identity and compatibility version for this profile provider.
public ProductConsumptionProfileBuilder WithProviderCompatibility(string providerId, int providerVersion)
Parameters
providerIdstringA stable, namespaced provider identifier.
providerVersionintA positive compatibility version.
Returns
- ProductConsumptionProfileBuilder
This builder for method chaining.