Class ChoicePromptInfo.Option
An option is a possible action and outcome for a ChoicePromptInfo. It is randomly chosen to be correct or incorrect, based on a multitude of factors that can be specified in the constructors.
Inheritance
Inherited Members
Namespace: TinyLife
Assembly: Tiny Life.dll
Syntax
public class Option
Constructors
Option(String, Action<ChoicePromptInfo, Person>, Action<ChoicePromptInfo, Person>, Func<Person, Single>)
Creates a new option with the given generic settings.
Declaration
public Option(string name, Action<ChoicePromptInfo, Person> successAction, Action<ChoicePromptInfo, Person> failAction, Func<Person, float> successWeight = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | This option's name, which will be localized. |
System.Action<ChoicePromptInfo, Person> | successAction | The action that should be invoked when this option is chosen as the correct option when the player selects it. |
System.Action<ChoicePromptInfo, Person> | failAction | The action that should be invoked when this option is chosen as the incorrect option when the player selects it. |
System.Func<Person, System.Single> | successWeight | The weight (or chance) with which this option will be randomly chosen as the correct one. If one of the options of a ChoicePromptInfo has a higher weight, it is more likely to be chosen than the other ones. |
Option(String, Func<Person, Single>, Func<Person, Single>, Func<Person, Single>)
Creates a new option with the given job-related outcomes.
Declaration
public Option(string name, Func<Person, float> jobPerformanceGained, Func<Person, float> jobPerformanceLost, Func<Person, float> successWeight = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | This option's name, which will be localized. |
System.Func<Person, System.Single> | jobPerformanceGained | A function that returns the amount of job performance that should be gained when the correct option is selected by the player. |
System.Func<Person, System.Single> | jobPerformanceLost | A function that returns the amount of job performance that should be lost when the incorrect option is selected by the player. |
System.Func<Person, System.Single> | successWeight | The weight (or chance) with which this option will be randomly chosen as the correct one. If one of the options of a ChoicePromptInfo has a higher weight, it is more likely to be chosen than the other ones. |
Option(String, EmotionType, Single, Single, Single)
Creates a new option with the given job-related outcomes.
Declaration
public Option(string name, EmotionType successIncreaseEmotion = null, float jobPerformanceGained = 0.1F, float jobPerformanceLost = 0.1F, float successWeight = 1F)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | This option's name, which will be localized. |
EmotionType | successIncreaseEmotion | |
System.Single | jobPerformanceGained | The amount of job performance that should be gained when the correct option is selected by the player. |
System.Single | jobPerformanceLost | The amount of job performance that should be lost when the incorrect option is selected by the player. |
System.Single | successWeight | The weight (or chance) with which this option will be randomly chosen as the correct one. If one of the options of a ChoicePromptInfo has a higher weight, it is more likely to be chosen than the other ones. |
Fields
FailAction
The action that should be invoked when this option is chosen as the incorrect option when the player selects it.
Declaration
public readonly Action<ChoicePromptInfo, Person> FailAction
Field Value
Type | Description |
---|---|
System.Action<ChoicePromptInfo, Person> |
Name
This option's name, which will be localized.
Declaration
public readonly string Name
Field Value
Type | Description |
---|---|
System.String |
SuccessAction
The action that should be invoked when this option is chosen as the correct option when the player selects it.
Declaration
public readonly Action<ChoicePromptInfo, Person> SuccessAction
Field Value
Type | Description |
---|---|
System.Action<ChoicePromptInfo, Person> |
SuccessWeight
The weight (or chance) with which this option will be randomly chosen as the correct one. If one of the options of a ChoicePromptInfo has a higher weight, it is more likely to be chosen than the other ones.
Declaration
public readonly Func<Person, float> SuccessWeight
Field Value
Type | Description |
---|---|
System.Func<Person, System.Single> |
Methods
Execute(ChoicePromptInfo, Person, Boolean)
Executes this option's result actions using the given ChoicePromptInfo.
Declaration
public void Execute(ChoicePromptInfo info, Person person, bool successful)
Parameters
Type | Name | Description |
---|---|---|
ChoicePromptInfo | info | The choice prompt that this option was a part of. |
Person | person | The person that should be affected by this option's outcome. |
System.Boolean | successful | Whether this option was chosen as the successful one. |