Table of Contents

Class DistinctGoal<T>

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

A distinct goal is an auto-triggered goal, intended to be used with AutoGoalInfo, that keeps track of a distinct set of objects to be completed or obtained. To trigger all distinct goals in a goal set, use Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).

public class DistinctGoal<T> : AutoTriggerGoal<T>, IGenericDataHolder

Type Parameters

T
Inheritance
JsonTypeSafeGenericDataHolder
DistinctGoal<T>
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

DistinctGoal(GoalSet, AutoGoalInfo)

public DistinctGoal(GoalSet set, AutoGoalInfo info)

Parameters

set GoalSet
info AutoGoalInfo

Methods

CanTrigger(object, GoalTrigger, object)

Returns whether this auto-triggered goal can currently be triggered. If this method returns true, Trigger(object) should always cause a change in this goal.

public override bool CanTrigger(object obj, GoalTrigger trigger, object value)

Parameters

obj object

The object that is triggering this goal.

trigger GoalTrigger

The type of goal trigger that is triggering this goal.

value object

The value to trigger, which will be passed to Trigger(object).

Returns

bool

Whether this goal can be triggered right now.

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 override 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 override 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 override void Reset()

Trigger(T)

Causes this auto-triggered goal to be triggered. This method should only be called if CanTrigger(object, GoalTrigger, object) returns true.

public override void Trigger(T value)

Parameters

value T

The value to trigger.

Validate(GoalSet)

Validates this goal when loading the underlying GoalSet from disk

public override bool Validate(GoalSet set)

Parameters

set GoalSet

The underlying goal set

Returns

bool

Whether this goal is considered to be valid