protected virtual void RegisterWithMessageSystem() { // Listen for Start, Stop, and Despawn messages: MessageSystem.AddListener(this, QuestMachineMessages.StartSpawnerMessage, spawnerName); MessageSystem.AddListener(this, QuestMachineMessages.StopSpawnerMessage, spawnerName); MessageSystem.AddListener(this, QuestMachineMessages.DespawnSpawnerMessage, spawnerName); }
private void ListenForMessages() { // Listen for messages for getting and dropping items: MessageSystem.AddListener(this, "Get", "Carrot"); MessageSystem.AddListener(this, "Get", "Wand"); MessageSystem.AddListener(this, "Get", "Coin"); MessageSystem.AddListener(this, "Drop", "Carrot"); MessageSystem.AddListener(this, "Drop", "Wand"); MessageSystem.AddListener(this, "Drop", "Coin"); }
public override void OnEnable() { base.OnEnable(); MessageSystem.AddListener(this, QuestMachineMessages.QuestStateChangedMessage, string.Empty); MessageSystem.AddListener(this, QuestMachineMessages.QuestCounterChangedMessage, string.Empty); MessageSystem.AddListener(this, QuestMachineMessages.RefreshUIsMessage, string.Empty); if (onlyTrackOneQuestAtATime) { MessageSystem.AddListener(this, QuestMachineMessages.QuestTrackToggleChangedMessage, string.Empty); } }
public override void StartChecking(System.Action trueAction) { base.StartChecking(trueAction); if (requiredQuestID == null) { return; } if (QuestMachine.GetQuestState(requiredQuestID) == requiredState) { SetTrue(); } else { MessageSystem.AddListener(this, QuestMachineMessages.QuestStateChangedMessage, requiredQuestID.value); } }
public void SetListeners(bool enable) { if (!Application.isPlaying || (enable && m_isListening) || (!enable && !m_isListening)) { return; } m_isListening = enable; if (enable) { switch (updateMode) { case QuestCounterUpdateMode.DataSync: MessageSystem.AddListener(this, DataSynchronizer.DataSourceValueChangedMessage, name); break; case QuestCounterUpdateMode.Messages: MessageSystem.AddListener(this, QuestMachineMessages.SetQuestCounterMessage, name); MessageSystem.AddListener(this, QuestMachineMessages.IncrementQuestCounterMessage, name); break; default: if (Debug.isDebugBuild) { Debug.LogWarning("Quest Machine: Internal error. Unrecognized counter update mode '" + updateMode + "'. Please contact the developer.", m_quest); } break; } if (messageEventList != null) { for (int i = 0; i < messageEventList.Count; i++) { var messageEvent = messageEventList[i]; if (messageEvent != null) { MessageSystem.AddListener(this, QuestMachineTags.ReplaceTags(messageEvent.message, m_quest), QuestMachineTags.ReplaceTags(messageEvent.parameter, m_quest)); } } } } else { MessageSystem.RemoveListener(this); } }
private void Awake() { m_rigidbody2D = GetComponent <Rigidbody2D>(); m_animator = GetComponent <Animator>(); m_sortByY = GetComponent <SortByY>(); if (m_rigidbody2D == null) { Debug.LogError("No Rigidbody2D found on " + name, this); } if (m_animator == null) { Debug.LogError("No Animator found on " + name, this); } if (m_sortByY == null) { m_sortByY = gameObject.AddComponent <SortByY>(); } MessageSystem.AddListener(this, "Pause Player", string.Empty); MessageSystem.AddListener(this, "Unpause Player", string.Empty); }
public void Awake() { MessageSystem.AddListener(MessageType.CharacterMove, OnCharacterMove); MessageSystem.AddListener(MessageType.InteractTap, OnInteractTap); MessageSystem.AddListener(MessageType.InteractHold, OnInteractHold); }
protected virtual void RegisterWithMessageSystem() { MessageSystem.AddListener(this, QuestMachineMessages.SetIndicatorStateMessage, string.Empty); MessageSystem.AddListener(this, QuestMachineMessages.RefreshIndicatorMessage, string.Empty); MessageSystem.AddListener(this, QuestMachineMessages.RefreshUIsMessage, string.Empty); }
public void AddListener(int key, Action <object[]> callback) { _msgSystem.AddListener(key, callback); }
public void OnEnable() { MessageSystem.AddListener(MessageType.SuccessfulInteract, OnSuccessfulInteract); }
protected virtual void OnEnable() { MessageSystem.AddListener(this, QuestMachineMessages.GroupButtonClickedMessage, string.Empty); }
public override void StartChecking(System.Action trueAction) { base.StartChecking(trueAction); MessageSystem.AddListener(this, runtimeMessage, runtimeParameter); }
private void OnEnable() { MessageSystem.AddListener(this, QuestMachineMessages.QuestAlertMessage, string.Empty); }
public void OnEnable() { MessageSystem.AddListener(MessageType.FinishTask, OnFinishTask); }