Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.RuntimeObjectives Class Reference
Inheritance diagram for AC.RuntimeObjectives:

Public Member Functions

void OnInitPersistentEngine ()
 
void SetObjectiveState (int objectiveID, int newStateID, bool selectAfter=false)
 Updates the state of an Objective More...
 
void SetObjectiveState (int objectiveID, ObjectiveStateType newStateType, bool selectAfter=false)
 Updates the state of an Objective More...
 
void SetObjectiveState (int objectiveID, int newStateID, int playerID)
 Updates the state of an Objective More...
 
ObjectiveState GetObjectiveState (int objectiveID)
 Gets the state of an active Objective. More...
 
ObjectiveState GetObjectiveState (int objectiveID, int playerID)
 Gets the state of an active Objective, held by a specific Player. More...
 
void CancelObjective (int objectiveID)
 Marks an Objective as inactive More...
 
ObjectiveInstance GetObjective (int objectiveID)
 Gets an instance of an active Objective More...
 
ObjectiveInstance[] GetObjectives (List< int > categoryIDs=null)
 Gets all active Objective instances More...
 
ObjectiveInstance[] GetObjectives (ObjectiveStateType objectiveStateType, List< int > categoryIDs=null)
 Gets all active Objective instances currently set to a particular type of state More...
 
ObjectiveInstance[] GetObjectives (ObjectiveDisplayType objectiveDisplayType, List< int > categoryIDs=null)
 Gets all active Objective instances currently set to a particular display type of state More...
 
void SelectObjective (int objectiveID)
 Selects an Objective, so that it can be displayed in a Menu More...
 
void DeselectObjective ()
 
void ClearAll ()
 
void ClearUniqueToPlayer ()
 
PlayerData SavePlayerObjectives (PlayerData playerData)
 Updates a PlayerData class with Objectives that are unique to the current Player. More...
 
void AssignPlayerObjectives (PlayerData playerData)
 Restores saved data from a PlayerData class More...
 
MainData SaveGlobalObjectives (MainData mainData)
 Updates a MainData class with Objectives that are shared by all Players. More...
 
void AssignGlobalObjectives (MainData mainData)
 Restores saved data from a MainData class More...
 

Protected Attributes

List< ObjectiveInstanceplayerObjectiveInstances = new List<ObjectiveInstance>()
 
List< ObjectiveInstanceglobalObjectiveInstances = new List<ObjectiveInstance>()
 
ObjectiveInstance selectedObjectiveInstance
 

Properties

ObjectiveInstance SelectedObjective [get, set]
 

Detailed Description

This script keeps track of all active Objectives.

Member Function Documentation

◆ AssignGlobalObjectives()

void AC.RuntimeObjectives.AssignGlobalObjectives ( MainData  mainData)

Restores saved data from a MainData class

Parameters
playerDataThe MainData class to load from

◆ AssignPlayerObjectives()

void AC.RuntimeObjectives.AssignPlayerObjectives ( PlayerData  playerData)

Restores saved data from a PlayerData class

Parameters
playerDataThe PlayerData class to load from

◆ CancelObjective()

void AC.RuntimeObjectives.CancelObjective ( int  objectiveID)

Marks an Objective as inactive

Parameters
objectiveIDThe ID of the Objective

◆ ClearAll()

void AC.RuntimeObjectives.ClearAll ( )

Clears all Objective data

◆ ClearUniqueToPlayer()

void AC.RuntimeObjectives.ClearUniqueToPlayer ( )

Clears all Objective data that's per-player, and not global

◆ DeselectObjective()

void AC.RuntimeObjectives.DeselectObjective ( )

De-selects the selected Objective

◆ GetObjective()

ObjectiveInstance AC.RuntimeObjectives.GetObjective ( int  objectiveID)

Gets an instance of an active Objective

Parameters
objectiveIDThe ID of the Objective to search for
Returns
The ObjectiveInstance if active, or null if not

◆ GetObjectives() [1/3]

ObjectiveInstance [] AC.RuntimeObjectives.GetObjectives ( List< int >  categoryIDs = null)

Gets all active Objective instances

Parameters
categoryIDsIf non-null, a list of category IDs that must include the Objective's own category ID for it to be returned
Returns
All active Objective instances

◆ GetObjectives() [2/3]

ObjectiveInstance [] AC.RuntimeObjectives.GetObjectives ( ObjectiveDisplayType  objectiveDisplayType,
List< int >  categoryIDs = null 
)

Gets all active Objective instances currently set to a particular display type of state

Parameters
objectiveDisplayTypeThe type of display state to search for
categoryIDsIf non-null, a list of category IDs that must include the Objective's own category ID for it to be returned
Returns
All active Objective instances set to the type of display state

◆ GetObjectives() [3/3]

ObjectiveInstance [] AC.RuntimeObjectives.GetObjectives ( ObjectiveStateType  objectiveStateType,
List< int >  categoryIDs = null 
)

Gets all active Objective instances currently set to a particular type of state

Parameters
objectiveStateTypeThe type of state to search for
categoryIDsIf non-null, a list of category IDs that must include the Objective's own category ID for it to be returned
Returns
All active Objective instances set to the type of state

◆ GetObjectiveState() [1/2]

ObjectiveState AC.RuntimeObjectives.GetObjectiveState ( int  objectiveID)

Gets the state of an active Objective.

Parameters
objectiveIDThe ID of the Objective
Returns
The Objective's state, if active. If inactive, null is returned

◆ GetObjectiveState() [2/2]

ObjectiveState AC.RuntimeObjectives.GetObjectiveState ( int  objectiveID,
int  playerID 
)

Gets the state of an active Objective, held by a specific Player.

Parameters
objectiveIDThe ID of the Objective
playerIDThe ID of the Player
Returns
The Objective's state, if active. If inactive, or no player data is found, null is returned

◆ SaveGlobalObjectives()

MainData AC.RuntimeObjectives.SaveGlobalObjectives ( MainData  mainData)

Updates a MainData class with Objectives that are shared by all Players.

Parameters
mainDataThe original MainData class
Returns
The updated MainData class

◆ SavePlayerObjectives()

PlayerData AC.RuntimeObjectives.SavePlayerObjectives ( PlayerData  playerData)

Updates a PlayerData class with Objectives that are unique to the current Player.

Parameters
playerDataThe original PlayerData class
Returns
The updated PlayerData class

◆ SelectObjective()

void AC.RuntimeObjectives.SelectObjective ( int  objectiveID)

Selects an Objective, so that it can be displayed in a Menu

Parameters
objectiveIDThe ID of the Objective to select

◆ SetObjectiveState() [1/3]

void AC.RuntimeObjectives.SetObjectiveState ( int  objectiveID,
int  newStateID,
bool  selectAfter = false 
)

Updates the state of an Objective

Parameters
objectiveIDThe ID of the Objective to update
newStateIDThe ID of the Objective's new state
selectAfterIf True, the Objective will be considered 'selected' upon being updated

◆ SetObjectiveState() [2/3]

void AC.RuntimeObjectives.SetObjectiveState ( int  objectiveID,
int  newStateID,
int  playerID 
)

Updates the state of an Objective

Parameters
objectiveIDThe ID of the Objective to update
newStateIDThe ID of the Objective's new state
playerIDThe ID of the Player whose Objectives to update, if the Objective is set per-Player

◆ SetObjectiveState() [3/3]

void AC.RuntimeObjectives.SetObjectiveState ( int  objectiveID,
ObjectiveStateType  newStateType,
bool  selectAfter = false 
)

Updates the state of an Objective

Parameters
objectiveIDThe ID of the Objective to update
newStateTypeThe ObjectiveStateType of the Objective's new state. If not states of this type are found, no change will be made. If multiple states of this type are found, the first will be set.
selectAfterIf True, the Objective will be considered 'selected' upon being updated

Property Documentation

◆ SelectedObjective

ObjectiveInstance AC.RuntimeObjectives.SelectedObjective
getset

The instance of the currently-selected Objective