public void CopyFrom(Quest quest)
 {
     if (quest == null)
     {
         Debug.LogWarning("Quest Machine: QuestProxy.CopyFrom source quest is null.");
         return;
     }
     isInstance            = quest.isInstance;
     id                    = StringField.GetStringValue(quest.id);
     displayName           = StringField.GetStringValue(quest.title);
     iconPath              = QuestMachine.GetImagePath(quest.icon);
     group                 = StringField.GetStringValue(quest.group);
     labels                = StringFieldsToStrings(quest.labels);
     giver                 = StringField.GetStringValue(quest.questGiverID);
     isTrackable           = quest.isTrackable;
     track                 = quest.showInTrackHUD;
     isAbandonable         = quest.isAbandonable;
     rememberIfAbandoned   = quest.rememberIfAbandoned;
     autostartConditionSet = new QuestConditionSetProxy(quest.autostartConditionSet);
     offerConditionSet     = new QuestConditionSetProxy(quest.offerConditionSet);
     offerUnmetContentList = QuestContentProxy.NewArray(quest.offerConditionsUnmetContentList);
     offerContentList      = QuestContentProxy.NewArray(quest.offerContentList);
     maxTimes              = quest.maxTimes;
     timesAccepted         = quest.timesAccepted;
     cooldownSecs          = quest.cooldownSeconds;
     cooldownSecsRemain    = quest.cooldownSecondsRemaining;
     state                 = quest.GetState();
     stateInfoList         = QuestStateInfoProxy.NewArray(quest.stateInfoList);
     counterList           = QuestCounterProxy.NewArray(quest.counterList);
     nodeList              = QuestNodeProxy.NewArray(quest.nodeList);
     tags                  = new TagDictionary(quest.tagDictionary);
     indicators            = QuestIndicatorStateRecordProxy.NewArray(quest.indicatorStates);
     goalEntity            = quest.goalEntityTypeName;
 }
        public static QuestCounterProxy[] NewArray(List <QuestCounter> counters)
        {
            if (counters == null)
            {
                Debug.LogWarning("Quest Machine: QuestCounterProxy.NewArray source is null.");
                return(new QuestCounterProxy[0]);
            }
            var array = new QuestCounterProxy[counters.Count];

            for (int i = 0; i < array.Length; i++)
            {
                array[i] = new QuestCounterProxy(counters[i]);
            }
            return(array);
        }
 public void CopyTo(Quest quest)
 {
     if (quest == null)
     {
         Debug.LogWarning("Quest Machine: QuestProxy.CopyTo destination quest is null.");
         return;
     }
     quest.isInstance                      = isInstance;
     quest.id                              = new StringField(id);
     quest.title                           = new StringField(displayName);
     quest.group                           = new StringField(group);
     quest.labels                          = StringsToStringFields(labels);
     quest.icon                            = QuestMachine.GetImage(iconPath);
     quest.questGiverID                    = new StringField(giver);
     quest.isTrackable                     = isTrackable;
     quest.showInTrackHUD                  = track;
     quest.isAbandonable                   = isAbandonable;
     quest.rememberIfAbandoned             = rememberIfAbandoned;
     quest.autostartConditionSet           = autostartConditionSet.CreateConditionSet();
     quest.offerConditionSet               = offerConditionSet.CreateConditionSet();
     quest.offerConditionsUnmetContentList = QuestContentProxy.CreateList(offerUnmetContentList);
     quest.offerContentList                = QuestContentProxy.CreateList(offerContentList);
     quest.maxTimes                        = maxTimes;
     quest.timesAccepted                   = timesAccepted;
     quest.UpdateCooldown();
     quest.cooldownSeconds          = cooldownSecs;
     quest.cooldownSecondsRemaining = cooldownSecsRemain;
     quest.stateInfoList            = QuestStateInfoProxy.CreateList(stateInfoList);
     quest.counterList        = QuestCounterProxy.CreateList(counterList);
     quest.nodeList           = QuestNodeProxy.CreateList(nodeList);
     quest.tagDictionary      = new TagDictionary(tags);
     quest.indicatorStates    = QuestIndicatorStateRecordProxy.ArrayToDictionary(indicators);
     quest.goalEntityTypeName = goalEntity;
     quest.SetRuntimeReferences();
     quest.SetState(state, false);
     QuestNodeProxy.CopyStatesTo(nodeList, quest);
 }