Table of Contents

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 string

The 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 enqueued

solveImportance float

The priority for solving this need over other needs, where higher numbers are more urgent

solvePercentage float

The 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

NeedType

Entertainment

public static readonly NeedType Entertainment

Field Value

NeedType

Hunger

public static readonly NeedType Hunger

Field Value

NeedType

Hygiene

public static readonly NeedType Hygiene

Field Value

NeedType

Name

The name of this need. Used for Localization purposes and saving to disk.

public readonly string Name

Field Value

string

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

Func<PersonLike, ActionType>

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

Func<PersonLike, TimeSpan>

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

Func<PersonLike, float>

Social

public static readonly NeedType Social

Field Value

NeedType

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

float

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

float

Toilet

public static readonly NeedType Toilet

Field Value

NeedType

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

ReadOnlyCollection<NeedType>

Properties

SourceString

A (localized) string that is displayed when hovering over an EmotionModifier that has this source

public string SourceString { get; }

Property Value

string

Methods

Register(NeedType)

Register the NeedType specified to the Types dictionary

public static NeedType Register(NeedType type)

Parameters

type NeedType

The need type to register

Returns

NeedType

The need type passed, for chaining