Exemplo n.º 1
0
	public ScriptedActionInfo ToInfo(ScriptedAction sa){ // saves values to an info for serialization (to XML)
		ScriptedActionInfo info = new ScriptedActionInfo();
		
		info.unityObjectName = sa.name;
		
		info.comment = sa.comment;
		info.objectName = sa.objectName;
		info.type = sa.type;
		info.role = sa.role; // in a multi-role script, which role performs this action
		info.stringParam = sa.stringParam;  // used for a lot of different things
//info.audioClipName = sa.audioClipName;
		info.fadeLength = sa.fadeLength; // also used for wait, move
		info.desiredAlpha = sa.desiredAlpha;
		info.desiredColor = sa.desiredColor;
//	public Texture2Dname texture2D = null; // used for enableInteraction;
//	public Transform moveTo;
		info.moveToName = sa.moveToName;
		info.offset = sa.offset; // offset from transform for move, in transform's reference frame
		info.orientation = sa.orientation;
		if (scriptToExecute != null)
			info.stringParam2 = scriptToExecute.name; //name is in
		info.ease = sa.ease;
		info.negate = sa.negate; // use to turn enable to disable, stop audio, etc.
		info.loop = sa.loop;
		info.waitForCompletion = sa.waitForCompletion; // signal complete after audio, fade, etc.
		info.sequenceEnd = sa.sequenceEnd;
		info.executeOnlyOnce = sa.executeOnlyOnce;
		info.block = sa.block;
		info.dialogIfThen = sa.dialogIfThen;
		info.breakpoint = false; // always clear when saving. sa.breakpoint;
		info.preAttributes = sa.preAttributes; // processed when the line is begun
		info.postAttributes = sa.postAttributes; // processed when the line completes
		info.stringParam2 = sa.stringParam2;
		info.stringParam3 = sa.stringParam3;
		info.stringParam4 = sa.stringParam4;
		info.attachmentOverride = sa.attachmentOverride;
		info.eventScript = sa.eventScript;
		info.voiceTag = sa.voiceTag;
		info.heading = sa.heading;
		info.speed = sa.speed;
		
		if (sa.gameMsgForm != null){
			info.gameMsgFormInfo = sa.gameMsgForm.ToInfo(sa.gameMsgForm);
//			info.gameMsg = sa.gameMsgForm.ToGameMsg(this); // how to handle message subclasses ?
			if (sa.gameMsgForm.map != null){
				info.map = sa.gameMsgForm.map.GetMap(); 
			}
		}
		if (sa.type==actionType.characterTask && sa.syncToTasks != null && sa.syncToTasks.Length > 0){
			info.syncToTasksIndex = new int[sa.syncToTasks.Length];
			for (int t = 0; t<sa.syncToTasks.Length; t++){
				if (sa.syncToTasks[t]==null){
					Debug.LogError("null sync task encountered in scripted action"+name);
					info.syncToTasksIndex[t] = sa.GetLineNumber();
				}
				else
				{
					info.syncToTasksIndex[t] = sa.syncToTasks[t].GetLineNumber();
				}
			}
		}
		
//	info.gameMsg = gameMsgForm.ToMessage();
//gameMsg;
//map;
		
		return info;
	}