/// <summary> /// Activates the target game objects and components if the condition is true. /// </summary> /// <param name='other'> /// The collider that entered the trigger. /// </param> public void OnTriggerEnter(Collider other) { if (condition.IsTrue(other.transform)) { SetTargets(true); } }
public virtual void Check() { if (enabled) { target.SetActive(condition.IsTrue(null)); } }
/// <summary> /// If the condition is true, starts the conversation between the specified actor and the /// character that this component is attached to. /// </summary> /// <param name='actor'> /// The actor to converse with. /// </param> public void TryStartConversation(Transform actor) { if (!tryingToStart) { tryingToStart = true; try { if ((condition == null) || condition.IsTrue(actor)) { if (string.IsNullOrEmpty(conversation)) { if (DialogueDebug.LogErrors) { Debug.LogError(string.Format("{0}: Conversation triggered on {1}, but conversation name is blank.", new System.Object[] { DialogueDebug.Prefix, name })); } } else if (DialogueManager.IsConversationActive) { if (DialogueDebug.LogWarnings) { Debug.LogWarning(string.Format("{0}: Conversation triggered on {1}, but another conversation is already active.", new System.Object[] { DialogueDebug.Prefix, name })); } } else { StartConversation(actor); } DestroyIfOnce(); } } finally { tryingToStart = false; } } }
public void TryIncrement() { if (!Application.isPlaying) { return; } if (DialogueManager.MasterDatabase == null) { return; } if (!(listenForOnDestroy && condition.IsTrue(null))) { return; } int oldValue = DialogueLua.GetVariable(ActualVariableName).AsInt; int newValue = Mathf.Clamp(oldValue + increment, min, max); DialogueLua.SetVariable(ActualVariableName, newValue); DialogueManager.SendUpdateTracker(); if (!(string.IsNullOrEmpty(alertMessage) || DialogueManager.Instance == null)) { if (Mathf.Approximately(0, alertDuration)) { DialogueManager.ShowAlert(alertMessage); } else { DialogueManager.ShowAlert(alertMessage, alertDuration); } } onIncrement.Invoke(); }
/// <summary> /// Show the alert if the condition is true. /// </summary> public void TryStart(Transform actor) { if (tryingToStart) { return; } tryingToStart = true; try { if (((condition == null) || condition.IsTrue(actor)) && !string.IsNullOrEmpty(message)) { string actualMessage = message; if ((localizedTextTable != null) && localizedTextTable.ContainsField(message)) { actualMessage = localizedTextTable[message]; } string text = FormattedText.Parse(actualMessage, DialogueManager.masterDatabase.emphasisSettings).text; if (Mathf.Approximately(0, duration)) { DialogueManager.ShowAlert(text); } else { DialogueManager.ShowAlert(text, duration); } DestroyIfOnce(); } } finally { tryingToStart = false; } }
/// <summary> /// Call this method to manually check the condition and fire the action /// if it's true. /// </summary> public void Check() { var observeTransform = (observeGameObject == null) ? null : observeGameObject.transform; if (condition.IsTrue(observeTransform)) { Fire(); } }
private void TryAddDatabases(Transform interactor, bool immediate) { if (!trying) { trying = true; try { if ((condition == null) || condition.IsTrue(interactor)) { AddDatabases(immediate); if (once) { Destroy(this); } } } finally { trying = false; } } }
/// <summary> /// Sets the quest status if the condition is true. /// </summary> public void TryStart(Transform actor) { if (tryingToStart) { return; } tryingToStart = true; try { if (((condition == null) || condition.IsTrue(actor)) && !string.IsNullOrEmpty(questName)) { Fire(); } } finally { tryingToStart = false; } }
public virtual void Check() { if (enabled) { if (target == null) { if (DialogueDebug.logWarnings) { Debug.LogWarning("Dialogue System: No target is assigned to Persistent Active Data component on " + name + ".", this); } } else { target.SetActive(condition.IsTrue(null)); } } }
/// <summary> /// Starts the sequence if the condition is true. /// </summary> public void TryStartSequence(Transform actor) { if (tryingToStart) { return; } tryingToStart = true; try { if (((condition == null) || condition.IsTrue(actor)) && !string.IsNullOrEmpty(sequence)) { DialogueManager.PlaySequence(sequence, Tools.Select(speaker, this.transform), Tools.Select(listener, actor)); DestroyIfOnce(); } } finally { tryingToStart = false; } }
/// <summary> /// Runs the Lua code if the condition is true. /// </summary> public void TryStart(Transform actor) { if (tryingToStart) { return; } tryingToStart = true; try { if (((condition == null) || condition.IsTrue(actor)) && !string.IsNullOrEmpty(luaCode)) { Lua.Run(luaCode, DialogueDebug.LogInfo); DialogueManager.CheckAlerts(); DestroyIfOnce(); } } finally { tryingToStart = false; } }
/// <summary> /// Sets the quest status if the condition is true. /// </summary> public void TryStart(Transform actor, Transform interactor) { if (tryingToStart) { return; } tryingToStart = true; try { if (((condition == null) || condition.IsTrue(interactor))) { Fire(actor); } } finally { tryingToStart = false; } }
public void TryIncrement() { if (!listenForOnDestroy) { return; } if (!condition.IsTrue(null)) { return; } int oldValue = DialogueLua.GetVariable(ActualVariableName).AsInt; int newValue = Mathf.Clamp(oldValue + increment, min, max); DialogueLua.SetVariable(ActualVariableName, newValue); DialogueManager.SendUpdateTracker(); if (!(string.IsNullOrEmpty(alertMessage) || DialogueManager.Instance == null)) { DialogueManager.ShowAlert(alertMessage); } }
/// <summary> /// Show the alert if the condition is true. /// </summary> public void TryStart(Transform actor) { if (tryingToStart) { return; } tryingToStart = true; try { if ((condition == null) || condition.IsTrue(actor)) { SetBindings(); playableDirector.Play(); DestroyIfOnce(); } } finally { tryingToStart = false; } }
/// <summary> /// Listens for an OnApplyPersistentData message from the PersistentDataManager, and sets a target /// game object accordingly. /// </summary> public void OnApplyPersistentData() { target.SetActive(condition.IsTrue(null)); }