public static InteractionSet BuildInteractionSet(IEnumerable<Part> parts)
        {
            InteractionSet set = new InteractionSet();

            foreach (PartList.Part part in parts)
            {
                Protein protein = new Protein();
                protein.stringExternalID = part.stringID;
                protein.sequence = part;
                protein.name = part.data.ShortDesc;

                protein.attributes["length"] = part.data.Sequence.Length.ToString();
                protein.attributes["biobrick"] = part.data.Name;
                protein.attributes["url"] = BiobrickCache.PartRegistryLink(part.data.Name);

                set.startProteins.Add(protein);
                set.proteins[part.stringID] = protein;
            }
            return set;
        }
예제 #2
0
	public void AddInteractionSet( InteractionSet set )
	{
		if ( InteractionSets == null )
			InteractionSets = new List<InteractionSet>();
		InteractionSets.Add(set);
	}
예제 #3
0
	public void InitFrom(InteractionScriptInfo info){
		// 	initialize members from deserialized info
		gameObject.name = info.unityObjectName; // this should only be done if we have gameobject per script
		
		triggerStrings = info.triggerStrings; // the string that causes this script to start running
		triggerOnStatus = info.triggerOnStatus; // should we listen to InteractStatusMessages for our trigger ?
		startingArgs = info.startingArgs;
		
		scriptLines = new ScriptedAction[info.scriptLines.Length];
		for (int i = 0; i<info.scriptLines.Length; i++){
			GameObject go = new GameObject(info.scriptLines[i].unityObjectName);
			go.transform.parent = this.transform;
			scriptLines[i] = go.AddComponent("ScriptedAction") as ScriptedAction;
			scriptLines[i].InitFrom(info.scriptLines[i]);	
		}
		// resolve any task sync cross references
		for (int j = 0; j<info.scriptLines.Length; j++){
			if (scriptLines[j].syncToTasks != null && scriptLines[j].syncToTasks.Length > 0){
				for (int k=0; k<scriptLines[j].syncToTasks.Length; k++){
					scriptLines[j].syncToTasks[k] = scriptLines[scriptLines[j].syncToTasksIndex[k]];
				}
			}
		}
		
//	public ScriptedAction.ScriptedActionInfo[] abortBranch; // the way out, if the user chooses not to complete this script
//	public ScriptedAction.ScriptedActionInfo[] errorBranch; // what to do if the script hangs, times out, encounters an error...
		owningRole = info.owningRole;
		roles = new List<string>(info.roles);
//		info.roles.CopyTo(roles);
//		roles = info.roles; // if null, then just one role for this script
		roleKeyString = info.roleKeyString;  // enter this as a string in the editor, it gets parsed into a node tree on awake.
		autoExecuteInterval = info.autoExecuteInterval;
		autoExecuteProbability = info.autoExecuteProbability;
		AddToMenu = info.AddToMenu;
		menuOrder = info.menuOrder;
		interactionSet = info.interactionSet;
		commandVariation = info.commandVariation;
		// failsafe in case of blank Cmd but variations present, default to use trigger string or script name
		if (commandVariation != null &&  commandVariation.Cmd == "" && commandVariation.Variations.Count>0){
			commandVariation.Cmd = name; // this is the convention we're using.  Trigger string might contain multiples
			Debug.LogWarning(name+" was missing commandVariations.Cmd value ");
		}
		if (commandVariation != null && commandVariation.Cmd != null && commandVariation.Cmd != "")		
			if (Application.isPlaying)
				FilterInteractions.GetInstance().AddVariation(commandVariation);
		callbackConfirmVoice = info.callbackConfirmVoice;
		item = info.item;
		prettyname = info.prettyname;
		response = info.response;
		response_title = info.response_title;
		note = info.note;
		tooltip = info.tooltip;
		sound = info.sound;
		task = info.task;
		log = info.log;
		readyState = info.readyState;  // since an object reference is required to calc this, no getter.
		startPriority = info.startPriority; // 0 is the lowest
		cancellable = info.cancellable;
		skillVector = info.skillVector;
		extraCost = info.extraCost;
		prereq = info.prereq;
		category = info.category;
		param = info.param;
		debug = info.debug; // print out debug logging while running		
	}
예제 #4
0
	// clear current set without causing a loop!
	public void AbortCurrentSet(){
		if (currentSet != null)
			currentSet.Init();
		currentSet = null;
	}