Class NeedType
- Namespace
- TinyLife
- Assembly
- Tiny Life.dll
A need is a desire that a PersonLike can have to a given extent. To register a custom need type, use Register(NeedType).
[JsonConverter(typeof(NeedType.Converter))]
public class NeedType : IEmotionSource
- Inheritance
-
NeedType
- Implements
- Inherited Members
- Extension Methods
Constructors
NeedType(string, Func<PersonLike, float>, Func<PersonLike, ActionType>, Func<PersonLike, TimeSpan>, float, float)
Instantiates a new need type with the given settings
public NeedType(string name, Func<PersonLike, float> passiveReduction, Func<PersonLike, ActionType> needLowAction = null, Func<PersonLike, TimeSpan> needLowTime = null, float solveImportance = 0, float solvePercentage = 0.5)
Parameters
name
stringThe name of this need
passiveReduction
Func<PersonLike, float>The amount that this need instance's Value is reduced by automatically every update frame
needLowAction
Func<PersonLike, ActionType>The action that is executed when this need's value is very low
needLowTime
Func<PersonLike, TimeSpan>The amount of in-game time until
needLowAction
is enqueuedsolveImportance
floatThe priority for solving this need over other needs, where higher numbers are more urgent
solvePercentage
floatThe percentage that this need has to be at or below for it to be auto-solved based on SolvedNeeds.
Fields
Energy
public static readonly NeedType Energy
Field Value
Entertainment
public static readonly NeedType Entertainment
Field Value
Hunger
public static readonly NeedType Hunger
Field Value
Hygiene
public static readonly NeedType Hygiene
Field Value
Name
The name of this need. Used for Localization purposes and saving to disk.
public readonly string Name
Field Value
NeedLowAction
The ActionType that is constructed and executed when this need type's Value is very low
public readonly Func<PersonLike, ActionType> NeedLowAction
Field Value
NeedLowTime
The amount of in-game time that needs to pass until NeedLowAction is constructed and enqueued
public readonly Func<PersonLike, TimeSpan> NeedLowTime
Field Value
PassiveReduction
The amount that a need instance's Value is reduced by automatically every update frame. To access this function's returned value, as well as the associated events and additional modifiers, use GetPassiveNeedReduction(NeedType).
public readonly Func<PersonLike, float> PassiveReduction
Field Value
Social
public static readonly NeedType Social
Field Value
SolveImportance
The priority for solving this need over other needs, where higher numbers represent a more urgent need. This value defaults to 0, meaning it has no special importance.
public readonly float SolveImportance
Field Value
SolvePercentage
The percentage that this need has to be at or below for it to be auto-solved based on SolvedNeeds.
public readonly float SolvePercentage
Field Value
Toilet
public static readonly NeedType Toilet
Field Value
Types
A list of all of the need types that are currently registered. Register custom need types using Register(NeedType).
public static readonly ReadOnlyCollection<NeedType> Types
Field Value
Properties
SourceString
A (localized) string that is displayed when hovering over an EmotionModifier that has this source
public string SourceString { get; }
Property Value
Methods
Register(NeedType)
public static NeedType Register(NeedType type)
Parameters
type
NeedTypeThe need type to register
Returns
- NeedType
The need type passed, for chaining