How do I get the argument on a listener? This is my custom condition script for Tracking message but I don¡t konw how to get the argument true / fasle:
public override void StartChecking(System.Action trueAction)
{
base.StartChecking(trueAction);
MessageSystem.AddListener(this, QuestMachineMessages.QuestTrackToggleChangedMessage, this.quest.id.ToString());
}
public void OnMessage(MessageArgs messageArgs)
{
if ((messageArgs.message == QuestMachineMessages.QuestTrackToggleChangedMessage) && (messageArgs.parameter == this.quest.id.ToString()) && messageArgs.)
{
SetTrue();
}
}
Listener argument
Re: Listener argument
Hi,
Here is the API reference: MessageArgs.
MessageArgs contains:
Code: Select all
if ((messageArgs.message == QuestMachineMessages.QuestTrackToggleChangedMessage) &&
(messageArgs.parameter == this.quest.id.ToString()) &&
((bool)messageArgs.firstValue == true))
MessageArgs contains:
- (string) message: The message.
- (string) parameter: The optional parameter that was sent with the message.
- (object[]) values: An array of objects passed as additional arguments. They can be mixed types (bool, int, etc.).
- (object) sender: The object that sent this message.
- (object) target: The object that this message is intended for. May be null if it's a general message for everyone.
- firstValue = values[0]
- intValue = (int)values[0]