Table of Contents

Class Goal

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

A goal is a component of a GoalSet which can be completed. A goal has an underlying GoalInfo that it is constructed from.

[DataContract]
public abstract class Goal : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
Goal
Implements
IGenericDataHolder
Derived
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Goal(GoalSet, GoalInfo)

Creates a new goal with the given settings

protected Goal(GoalSet set, GoalInfo info)

Parameters

set GoalSet

The goal set that this goal is a part of

info GoalInfo

The underlying goal info that this goal has been constructed from

Fields

Name

The name of this goal, based on the underlying GoalInfo

[DataMember]
public readonly string Name

Field Value

string

Properties

Info

The underlying goal info that this goal has been constructed from

public GoalInfo Info { get; }

Property Value

GoalInfo

Set

The goal set that this goal is a part of

public GoalSet Set { get; }

Property Value

GoalSet

Methods

GetDisplay(Anchor, bool, bool)

Returns a MLEM.Ui.Elements.Group that contains the content to display to the player for this goal.

public Group GetDisplay(Anchor anchor, bool descriptionAsChild = false, bool reduced = false)

Parameters

anchor Anchor

The anchor to use for the group.

descriptionAsChild bool

Whether to add the description as a child, rather than a tooltip.

reduced bool

Whether certain elements, like the name and description, should be left out, displaying only the progress of the goal.

Returns

Group

The display group.

GetDisplayedProgress(bool)

Returns a string that is used in a goal set's displayed ui information that determines the progress of this goal. By default, the GetProgress() percentage is displayed as a percentage between 0 and 100.

public virtual string GetDisplayedProgress(bool reduced)

Parameters

reduced bool

Returns

string

The displayed goal progress

GetProgress()

Returns the progress percentage (between 0 and 1) that this goal has

public abstract float GetProgress()

Returns

float

The progress percentage

Reset()

Resets this goal to the default values, which should cause 0 to be returned on GetProgress()

public abstract void Reset()

Validate(GoalSet)

Validates this goal when loading the underlying GoalSet from disk

public virtual bool Validate(GoalSet set)

Parameters

set GoalSet

The underlying goal set

Returns

bool

Whether this goal is considered to be valid