The Objective is the interface for a user’s Quest Objective
public class Objective : Sansar.Script.InstanceInterfaceMembers at a glance
| Kind | Members |
|---|---|
| Properties | Agent · Count · Definition · Ready |
| Methods | GetState · SetState · Subscribe · ToString · Update |
Properties
Agent
public Sansar.Script.SessionId Agent { get; }The session Id for the user on this quest.
Count
public int Count { get; set; }Get the number of objectives collected for this user.
Remarks
Returns -1 if the Objective is not Ready.
Definition
Ready
public bool Ready { get; }If the Objective data is ready.
Remarks
Returns false until the data has been fetched from the quest service. Once it returns true it will always return true.
Methods
GetState
public ObjectiveState GetState()The ObjectiveState representing the user’s progress in the quest
Returns: ObjectiveState
SetState
public void SetState(ObjectiveState state)Set the state of the objective.
| Parameter | Type | Description |
|---|---|---|
state | ObjectiveState | The state to transition to. |
Remarks
Some state changes may not be permitted, in these cases OperationCompleteEvent success will be false.
public void SetState(
ObjectiveState state,
Action<Sansar.Script.OperationCompleteEvent> handler
)Set the state of the objective.
| Parameter | Type | Description |
|---|---|---|
state | ObjectiveState | The state to transition to. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Some state changes may not be permitted, in these cases OperationCompleteEvent success will be false.
Subscribe
public Sansar.Script.IEventSubscription Subscribe(
ObjectiveState State,
Action<ObjectiveData> callback,
bool persistent
)Subscribes to Objective Events.
| Parameter | Type | Description |
|---|---|---|
State | ObjectiveState | The state of the objective |
callback | Action<ObjectiveData> | Callback which is executed when the event completes. |
persistent | bool | Optional, set to false to unsubscribe after one event. |
Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.
ToString
public override string ToString()A string representation of this object.
Returns: string — A string representation of this object.
Remarks
The format of this string may change between releases.
Update
public void Update()Update the ObjectiveDefinition data.
Remarks
Use in a WaitFor to wait for the data for the QuestDefinition to be ready. Once data is retrieved and Ready is true it will never again be false.
public void Update(
Action<Sansar.Script.OperationCompleteEvent> handler
)Update the ObjectiveDefinition data.
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Use in a WaitFor to wait for the data for the QuestDefinition to be ready. Once data is retrieved and Ready is true it will never again be false.
Used in examples
- QuestDebugExample.cs
- ScriptLibrary/Quest/QuestGiverInteraction.cs
- ScriptLibrary/Quest/QuestGiverTrigger.cs
- ScriptLibrary/Quest/QuestObject.cs
- ScriptLibrary/Quest/QuestObjectBase.cs
- ScriptLibrary/Quest/QuestObjectInteraction.cs
- ScriptLibrary/Quest/QuestObjectTrigger.cs
- ScriptLibrary/Quest/QuestVisibility.cs
Generated from the Sansar 47.10.0 client ScriptApi snapshot.