protected override void GenerateMethod(Node node, StreamWriter stream, string indent)
        {
            SelectorStochastic selectorStochastic = node as SelectorStochastic;

            Debug.Check(selectorStochastic != null);

            stream.WriteLine("{0}\t\tpublic void Initialize(string method)", indent);
            stream.WriteLine("{0}\t\t{{", indent);
            stream.WriteLine("{0}\t\t\tthis.m_method = Action.LoadMethod(method);", indent);
            stream.WriteLine("{0}\t\t}}", indent);
        }
        public override void GenerateInstance(Node node, StreamWriter stream, string indent, string nodeName, string agentType, string btClassName)
        {
            base.GenerateInstance(node, stream, indent, nodeName, agentType, btClassName);

            SelectorStochastic selectorStochastic = node as SelectorStochastic;

            Debug.Check(selectorStochastic != null);

            if (selectorStochastic.RandomGenerator != null)
            {
                string method = selectorStochastic.RandomGenerator.GetExportValue().Replace("\"", "\\\"");

                stream.WriteLine("{0}\t{1}.Initialize(\"{2}\");", indent, nodeName, method);
            }
        }
Esempio n. 3
0
        protected override void GenerateMethod(Node node, StreamWriter stream, string indent)
        {
            SelectorStochastic sel = node as SelectorStochastic;

            if (sel == null)
            {
                return;
            }

            stream.WriteLine("{0}\tpublic:", indent);

            stream.WriteLine("{0}\t\tvoid Initialize(const char* method)", indent);
            stream.WriteLine("{0}\t\t{{", indent);
            stream.WriteLine("{0}\t\t\tthis->m_method = AgentMeta::ParseMethod(method);", indent);
            stream.WriteLine("{0}\t\t}}", indent);
        }
        protected override void GenerateMethod(Node node, StringWriter stream, string indent)
        {
            SelectorStochastic sel = node as SelectorStochastic;

            if (sel == null)
            {
                return;
            }

            if (sel.RandomGenerator != null)
            {
                stream.WriteLine("{0}\t\tpublic void Initialize(string method)", indent);
                stream.WriteLine("{0}\t\t{{", indent);
                stream.WriteLine("{0}\t\t\tthis.m_method = AgentMeta.ParseMethod(method);", indent);
                stream.WriteLine("{0}\t\t}}", indent);
            }
        }
Esempio n. 5
0
        protected override void GenerateConstructor(Node node, StringWriter stream, string indent, string className)
        {
            base.GenerateConstructor(node, stream, indent, className);

            SelectorStochastic sel = node as SelectorStochastic;

            if (sel == null)
            {
                return;
            }

            if (sel.RandomGenerator != null)
            {
                stream.WriteLine("{0}\t\t\tthis.Initialize(\"{1}\");",
                                 indent, sel.RandomGenerator.GetExportValue());
            }
        }
        protected override bool ShouldGenerateClass(Node node)
        {
            SelectorStochastic sel = node as SelectorStochastic;

            return(sel != null);
        }