Пример #1
0
        public bool?CheckCondition(Condition.PredicateType predicate, string[] parameters)
        {
            switch (predicate)
            {
            case Condition.PredicateType.HasItem:
                if (parameters.Length == 1 && !string.IsNullOrEmpty(parameters[0]))
                {
                    InventoryItem item = InventoryItem.GetFromID(parameters[0]);
                    if (item)
                    {
                        return(HasItem(item));
                    }

                    Debug.LogError($"Item of ID '{parameters[0]}' does not exist.");
                }
                else
                {
                    Debug.LogError("Parameter list error.");
                }

                break;
            }

            return(null);
        }
Пример #2
0
        public bool?CheckCondition(Condition.PredicateType predicate, string[] parameters)
        {
            switch (predicate)
            {
            case Condition.PredicateType.HasQuest:
                if (parameters.Length == 1)
                {
                    Quest quest = Quest.FindQuest(parameters[0]);
                    if (quest)
                    {
                        return(HasQuest(quest));
                    }

                    Debug.LogError($"Quest of ID '{parameters[0]}' does not exist.");
                }
                else
                {
                    Debug.LogError("Parameter list error.");
                }

                break;

            case Condition.PredicateType.ClearedObjective:
                if (parameters.Length == 2)
                {
                    Quest quest = Quest.FindQuest(parameters[0]);
                    if (quest)
                    {
                        return(FindQuest(quest).HasCleared(parameters[1]));
                    }

                    Debug.LogError($"Quest of ID '{parameters[0]}' does not exist.");
                }
                else
                {
                    Debug.LogError("Parameter list error.");
                }

                break;

            case Condition.PredicateType.ClearedQuest:
                if (parameters.Length == 1)
                {
                    Quest quest = Quest.FindQuest(parameters[0]);
                    if (quest)
                    {
                        return(FindQuest(quest).IsComplete());
                    }

                    Debug.LogError($"Quest of ID '{parameters[0]}' does not exist.");
                }
                else
                {
                    Debug.LogError("Parameter list error.");
                }

                break;
            }

            return(null);
        }