示例#1
0
 public void CloneSubassetsInto(QuestNode copy)
 {
     // Assumes lists are identical except subassets haven't been copied.
     if (copy == null)
     {
         return;
     }
     conditionSet.CloneSubassetsInto(copy.conditionSet);
     QuestStateInfo.CloneSubassets(stateInfoList, copy.stateInfoList);
     tagDictionary.CopyInto(copy.tagDictionary);
 }
示例#2
0
        /// <summary>
        /// Returns a new instance of the quest, including new instances of all subassets
        /// such as QuestAction, QuestCondition, and QuestContent subassets.
        /// </summary>
        public Quest Clone()
        {
            var clone = Instantiate(this);

            SetRuntimeReferences(); // Fix original's references since Instantiate calls OnEnable > SetRuntimeReferences while clone's fields still point to original.
            clone.isInstance    = true;
            clone.originalAsset = originalAsset;
            autostartConditionSet.CloneSubassetsInto(clone.autostartConditionSet);
            offerConditionSet.CloneSubassetsInto(clone.offerConditionSet);
            clone.offerConditionsUnmetContentList = QuestSubasset.CloneList(offerConditionsUnmetContentList);
            clone.offerContentList = QuestSubasset.CloneList(offerContentList);
            QuestStateInfo.CloneSubassets(stateInfoList, clone.stateInfoList);
            QuestNode.CloneSubassets(nodeList, clone.nodeList);
            tagDictionary.CopyInto(clone.tagDictionary);
            clone.SetRuntimeReferences();
            return(clone);
        }