Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.29 KB

File metadata and controls

35 lines (25 loc) · 1.29 KB

QuestState

Purpose: A class that stores the runtime state (progress) of a quest during gameplay. A QuestState is generated by the QuestManager when the player accepts a quest, kept in memory, and serialized to JSON for save files.

Description

QuestState is not configured directly in the Inspector (except for debugging if you inspect the array inside QuestManager). It is purely a runtime object.

It stores:

  1. The quest identifier (_questId).
  2. The current status (_status: NotStarted, Active, Completed, Failed).
  3. A list of current progress values for each objective (e.g., how many boars killed).
  4. A list of completion flags for each objective (true/false).

Code Usage

Usually, you do not modify QuestState manually. You interact with it via QuestManager. However, if you want to display progress in the UI, you can retrieve it:

// Get the state of an active quest
QuestState state = QuestManager.I.GetState("kill_boars");

if (state != null) {
    // Check how many items we've collected for the first objective (index 0)
    int currentAmount = state.GetObjectiveProgress(0);
    
    // Check if the objective is completed
    bool isDone = state.IsObjectiveCompleted(0);
}

See Also