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.
public class ChoicePromptInfo.Option
- Inheritance
-
ChoicePromptInfo.Option
- Inherited Members
- Extension Methods
Constructors
Option(string, Action<ChoicePromptInfo, PersonLike>, Action<ChoicePromptInfo, PersonLike>, Func<PersonLike, float>)
Creates a new option with the given generic settings.
public Option(string name, Action<ChoicePromptInfo, PersonLike> successAction, Action<ChoicePromptInfo, PersonLike> failAction, Func<PersonLike, float> successChance)
Parameters
namestringThis option's name, which will be localized.
successActionAction<ChoicePromptInfo, PersonLike>The action that should be invoked when this option is chosen as the correct option when the player selects it.
failActionAction<ChoicePromptInfo, PersonLike>The action that should be invoked when this option is chosen as the incorrect option when the player selects it.
successChanceFunc<PersonLike, float>A function that determines the success change of this choice prompt option once it's chosen, which is expected to be a value between 0 and 1.
Option(string, Func<Person, float>, Func<Person, float>, Func<Person, float>)
Creates a new option with the given job-related outcomes.
public Option(string name, Func<Person, float> jobPerformanceGained, Func<Person, float> jobPerformanceLost, Func<Person, float> successChance)
Parameters
namestringThis option's name, which will be localized.
jobPerformanceGainedFunc<Person, float>A function that returns the amount of job performance that should be gained when the correct option is selected by the player.
jobPerformanceLostFunc<Person, float>A function that returns the amount of job performance that should be lost when the incorrect option is selected by the player.
successChanceFunc<Person, float>A function that determines the success change of this choice prompt option once it's chosen, which is expected to be a value between 0 and 1.
Option(string, EmotionType, SkillType, float, float, float)
Creates a new option with the given job-related outcomes.
public Option(string name, EmotionType successIncreaseEmotion = null, SkillType successIncreaseSkill = null, float jobPerformanceGained = 0.1, float jobPerformanceLost = 0.1, float successChance = 0.5)
Parameters
namestringThis option's name, which will be localized.
successIncreaseEmotionEmotionTypeAn emotion that optionally increases the success chance of this option.
successIncreaseSkillSkillTypeA skill that optionally increases the success chance of this option.
jobPerformanceGainedfloatThe amount of job performance that should be gained when the correct option is selected by the player.
jobPerformanceLostfloatThe amount of job performance that should be lost when the incorrect option is selected by the player.
successChancefloatThe success chance of this option, which is expected to be a value between 0 and 1.
Fields
FailAction
The action that should be invoked when this option is chosen as the incorrect option when the player selects it.
public readonly Action<ChoicePromptInfo, PersonLike> FailAction
Field Value
Name
This option's name, which will be localized.
public readonly string Name
Field Value
SuccessAction
The action that should be invoked when this option is chosen as the correct option when the player selects it.
public readonly Action<ChoicePromptInfo, PersonLike> SuccessAction
Field Value
SuccessChance
A function that determines the success change of this choice prompt option once it's chosen, which is expected to be a value between 0 and 1.
public readonly Func<PersonLike, float> SuccessChance
Field Value
Methods
Execute(ChoicePromptInfo, PersonLike, bool)
Executes this option's result actions using the given ChoicePromptInfo.
public void Execute(ChoicePromptInfo info, PersonLike person, bool successful)
Parameters
infoChoicePromptInfoThe choice prompt that this option was a part of.
personPersonLikeThe person that should be affected by this option's outcome.
successfulboolWhether this option was chosen as the successful one.