/// <summary> /// Waits a frame then gets character reference. /// </summary> /// <returns>The character after wait.</returns> protected IEnumerator GetCharacterAfterWait() { // Wait a frame for group to load yield return(true); if (group == null) { base.GetCharacter(); } else { // We use the action groups character if (group.requireMatchingItem) { itemId = activationItemId; GetItemManager(); } group.Activated += HandleActivationChange; group.Deactivated += HandleActivationChange; if (group.IsActive(activationItemId)) { Activate(); } else { Deactivate(); } } }
/// <summary> /// Checks the condition. For example a check when entering a trigger. /// </summary> /// <returns><c>true</c>, if enter trigger was shoulded, <c>false</c> otherwise.</returns> /// <param name="character">Character.</param> /// <param name="other">Other.</param> override public bool CheckCondition(Character character, object other) { if (group == null || !cacheActivationGroup) { foreach (ActivationGroup ag in character.GetComponentsInChildren <ActivationGroup>()) { if (ag.items.Contains(itemId)) { group = ag; break; } } } if (group == null) { Debug.LogWarning("Conditions requires an ActivationGroup but a matching group could not be found."); return(false); } if (!group.IsActive(itemId)) { return(true); } return(false); }