Skip to main content

GameAction

An abstract class in Root.Township, the global namespace.

Asset for a tracked player action (docking an item, destroying something and so on) that feeds tasks and achievements. Server: GameTaskManager collects the ones valid for the current scene and counts them per player.

Constructors​

MemberWhat it is
protected GameAction()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

3 private and internal fields
MemberWhat it is
private StatType statTypeBacking field for StatType.
private int targetSceneIndexSingle scene index (-1 for all scenes). Not read anywhere; ValidateScene uses targetSceneIndexes.
private int[] targetSceneIndexesScene indexes the action counts in. Empty means every scene. Read by ValidateScene.

Properties​

MemberWhat it is
abstract GameActionChannel Channel { get; }Which kind of action this listens for. Only actions reported on this channel are checked.
StatType StatType { get; }The kind of stat this action tracks.

Events​

MemberWhat it is
event IncrementStat IncrementValueRaised by IncrementForPlayer. The task manager listens to it.
event UpdateStat ValueUpdateRaised by UpdateForPlayer. The task manager listens to it.

Methods​

MemberWhat it is
void IncrementForPlayer(IPlayer player)Adds one to this action's count for a player.
abstract bool IsValid(GameTaskActionArgument argument)Whether a reported action argument counts for this action.
virtual int ReceiveNewValue(int currentValue, int newValue)Combines the current count with a new one. Adds them by default.
void UpdateForPlayer(IPlayer player, int value)Sets this action's value for a player.
void UpdateForPlayer(IPlayer player, float value)Sets this action's value for a player.
bool ValidateScene(int sceneIndex)True if the action applies in the given scene index. An empty scene list means every scene.

Used in​

Members of other types that take, return or hold a GameAction: