private void ExportAttachment(StreamWriter file, string btClassName, string agentType, string parentName, Node node, string indent) { if (node.Attachments.Count > 0) { file.WriteLine("{0}// attachments", indent); foreach (Behaviac.Design.Attachments.Attachment attach in node.Attachments) { file.WriteLine("{0}{{", indent); string nodeName = string.Format("attach{0}", attach.Id); // export its instance and the properties AttachmentCsExporter attachmentExporter = AttachmentCsExporter.CreateInstance(attach); attachmentExporter.GenerateInstance(attach, file, indent, nodeName, agentType, btClassName); ExportPars(file, nodeName, attach, indent); file.WriteLine("{0}\t{1}.Attach({2});", indent, parentName, nodeName); if (attach is Behaviac.Design.Attachments.Event) { file.WriteLine("{0}\t{1}.SetHasEvents({1}.HasEvents() | ({2} is Event));", indent, parentName, nodeName); } file.WriteLine("{0}}}", indent); } } }
private void ExportAttachment(StreamWriter file, string btClassName, string agentType, string parentName, Node node, string indent) { if (node.Attachments.Count > 0) { file.WriteLine("{0}// attachments", indent); foreach (Behaviac.Design.Attachments.Attachment attach in node.Attachments) { if (!attach.Enable || attach.IsStartCondition) { continue; } file.WriteLine("{0}{{", indent); string nodeName = string.Format("attach{0}", attach.Id); // export its instance and the properties AttachmentCsExporter attachmentExporter = AttachmentCsExporter.CreateInstance(attach); attachmentExporter.GenerateInstance(attach, file, indent, nodeName, agentType, btClassName); string isPrecondition = attach.IsPrecondition && !attach.IsTransition ? "true" : "false"; string isEffector = attach.IsEffector && !attach.IsTransition ? "true" : "false"; string isTransition = attach.IsTransition ? "true" : "false"; file.WriteLine("{0}\t{1}.Attach({2}, {3}, {4}, {5});", indent, parentName, nodeName, isPrecondition, isEffector, isTransition); if (attach is Behaviac.Design.Attachments.Event) { file.WriteLine("{0}\t{1}.SetHasEvents({1}.HasEvents() | ({2} is Event));", indent, parentName, nodeName); } file.WriteLine("{0}}}", indent); } } }
private void ExportAttachmentClass(StreamWriter file, string btClassName, Node node) { foreach (Behaviac.Design.Attachments.Attachment attach in node.Attachments) { string nodeName = string.Format("attach{0}", attach.Id); AttachmentCsExporter attachmentExporter = AttachmentCsExporter.CreateInstance(attach); attachmentExporter.GenerateClass(attach, file, "", nodeName, btClassName); } }