Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(ConsoleWriter), "ConsoleWriter", null);
        }
Beispiel #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, GuiService guiService)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();

            objectBuilder.registerElement(new Constructor(guiService), sequenceBuilder.CurrentSequence, typeof(Button), "Button", null);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, NavigationMeshService manager)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();

            objectBuilder.registerElement(new Constructor(manager), sequenceBuilder.CurrentSequence, typeof(NavigationMeshPose3D), "NavigationMeshPose3D", null);
        }
Beispiel #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="objectBuilder"></param>
 public static void registerElement(IObjectBuilder objectBuilder)
 {
     ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
     sequenceBuilder.createSequence();
     basicRegistration(sequenceBuilder);
     objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(MeshCollider), "MeshCollider");
 }
Beispiel #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IntParameter("timeout", "1000")); // miliseconds

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(AutoDestroyLogic),"AutoDestroyLogic", null);
        }
Beispiel #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, IInputManager inputManager)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new FloatParameter("position", "0,0,0")); //
            sequenceBuilder.addParameter(new FloatParameter("speed","1"));

            objectBuilder.registerElement(new Constructor(inputManager), sequenceBuilder.CurrentSequence, typeof(KeyboardPosition3D), "KeyboardPosition3D", null);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, AnimationService animationService)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new FloatParameter("position","0.0,0.0,0.0"));
            sequenceBuilder.addParameter(new IdParameter("animation",""));

            objectBuilder.registerElement(new Constructor(animationService), sequenceBuilder.CurrentSequence, typeof(AnimationPosition3D), "AnimationPosition3D", null);
        }
Beispiel #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="objectBuilder"></param>
 public static void registerElement(IObjectBuilder objectBuilder)
 {
     ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
     sequenceBuilder.createSequence();
     sequenceBuilder.addParameter(new IdParameter("id",""));
     sequenceBuilder.addParameter(new IdParameter("enterScript", ""));
     sequenceBuilder.addParameter(new IdParameter("exitScript", ""));
     objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(ScriptState), "ScriptState", null);
 }
Beispiel #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            basicRegistration(sequenceBuilder);
            sequenceBuilder.addParameter(new FloatParameter("radius", "0.5"));

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(SphereCollider), "SphereCollider", null);
        }
Beispiel #10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, IInputManager inputManager)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new BoolParameter("invertY", "false")); //
            sequenceBuilder.addParameter(new BoolParameter("invertX", "false")); //
            sequenceBuilder.addParameter(new FloatParameter("scale", "0.001"));

            objectBuilder.registerElement(new Constructor(inputManager), sequenceBuilder.CurrentSequence, typeof(TouchRotation3D), "TouchRotation3D", null);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, AnimationService animationService)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("animationId",XnaScrapId.INVALID_ID.ToString()));
            sequenceBuilder.addParameter(new FloatParameter("time","0.0"));
            sequenceBuilder.addParameter(new SequenceParameter("values", new FloatParameter("timeAndValue","0.0,0.0"))); //

            objectBuilder.registerElement(new Constructor(animationService), sequenceBuilder.CurrentSequence, typeof(AnimationValueCreator), "AnimationValueCreator", null);
        }
Beispiel #12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            basicRegistration(sequenceBuilder);
            sequenceBuilder.addParameter(new FloatParameter("radius", "1.0"));
            sequenceBuilder.addParameter(new FloatParameter("height", "1.0"));

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(CapsuleCollider), "CapsuleCollider");
        }
Beispiel #13
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            basicRegistration(sequenceBuilder);
            sequenceBuilder.addParameter(new FloatParameter("normal", "0.0,1.0,0.0"));
            sequenceBuilder.addParameter(new FloatParameter("d", "0.0"));
            sequenceBuilder.addParameter(new FloatParameter("bb_min", "-0.5,-0.5,-0.5"));
            sequenceBuilder.addParameter(new FloatParameter("bb_max", "0.5,0.5,0.5"));

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(PlaneCollider), "PlaneCollider");
        }
Beispiel #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();

            CompoundParameter transition = new CompoundParameter("transition");
            transition.addParameter(new IdParameter("msg", ""));
            transition.addParameter(new IdParameter("from",""));
            transition.addParameter(new IdParameter("to", ""));

            sequenceBuilder.addParameter(new IdParameter("initState", ""));
            sequenceBuilder.addParameter(new SequenceParameter("transitions", transition));

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(StateMachine), "StateMachine", null);
        }
Beispiel #15
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new FloatParameter("scale", "1, 1, 1")); // miliseconds
            ParameterSequence parameters = sequenceBuilder.CurrentSequence;

            // messages
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_SCALE_MSG_ID.ToString()));
            sequenceBuilder.addParameter(new FloatParameter("scale", "1,1,1"));
            List<ParameterSequence> messages = new List<ParameterSequence> { sequenceBuilder.CurrentSequence };

            objectBuilder.registerElement(new Constructor(), parameters, typeof(StaticScale3D), "StaticScale3D", messages);
        }
Beispiel #16
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            //sequenceBuilder.addParameter(new FloatParameter("orientation", "0, 0, 0, 1")); // x,y,z,angle
            sequenceBuilder.addParameter(new FloatParameter("orientation", "0, 0, 0")); // x,y,z,angle
            ParameterSequence parameters = sequenceBuilder.CurrentSequence;

            // messages
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_ORIENTATION_MSG_ID.ToString()));
            //sequenceBuilder.addParameter(new FloatParameter("orientation", "0,0,0,1"));
            sequenceBuilder.addParameter(new FloatParameter("orientation", "0,0,0"));

            List<ParameterSequence> messages = new List<ParameterSequence> { sequenceBuilder.CurrentSequence };

            objectBuilder.registerElement(new Constructor(), parameters, typeof(StaticOrientation3D), "StaticOrientation3D", messages);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new FloatParameter("speed","0.01"));
            sequenceBuilder.addParameter(new SequenceParameter("path", new FloatParameter("position","0,0,0")));

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(PathFollowPosition3D),"PathFollowPosition3D", null);
        }
Beispiel #18
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, RenderManager renderMan)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();

            sequenceBuilder.addParameter(new IdParameter("renderTarget",DefaultRenderTarget.DEFAULT_RENDERTARGET_ID.ToString()));
            CompoundParameter frustum = new CompoundParameter("Frustum");
            frustum.addParameter(new FloatParameter("fovy","45.0"));
            frustum.addParameter(new FloatParameter("near","1.0"));
            frustum.addParameter(new FloatParameter("far", "1000.0"));
            #if WINDOWS_PHONE
            frustum.addParameter(new FloatParameter("aspect", "1.6666666666666"));     // 1.666666666
            #else
            frustum.addParameter(new FloatParameter("aspect", "1.333333333"));
            #endif
            sequenceBuilder.addParameter(frustum);
            CompoundParameter viewport = new CompoundParameter("Viewport");
            viewport.addParameter(new IntParameter("x", "0"));
            viewport.addParameter(new IntParameter("y", "0"));
            viewport.addParameter(new IntParameter("w", "-1")); // this means full size
            viewport.addParameter(new IntParameter("h", "-1"));

            sequenceBuilder.addParameter(viewport);

            ParameterSequence parameters = sequenceBuilder.CurrentSequence;

            // messages
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_PROJ_ID.ToString()));
            sequenceBuilder.addParameter(new FloatParameter("fovy", "45.0"));
            sequenceBuilder.addParameter(new FloatParameter("near", "1.0"));
            sequenceBuilder.addParameter(new FloatParameter("far", "1000.0"));
            #if WINDOWS_PHONE
            sequenceBuilder.addParameter(new FloatParameter("aspect", "1.6666666666666"));     // 1.666666666
            #else
            sequenceBuilder.addParameter(new FloatParameter("aspect", "1.333333333"));
            #endif
            List<ParameterSequence> messages = new List<ParameterSequence> { sequenceBuilder.CurrentSequence };

            objectBuilder.registerElement(new Constructor(renderMan), parameters, typeof(Camera), "Camera", messages);
        }
Beispiel #19
0
        protected static void baseRegisterMessages(ParameterSequenceBuilder sequenceBuilder, List<ParameterSequence> messages)
        {
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_VISIBILITY_MSG_ID.ToString()));
            sequenceBuilder.addParameter(new BoolParameter("visible", "true"));
            messages.Add(sequenceBuilder.CurrentSequence);

            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_LAYER_MSG_ID.ToString()));
            sequenceBuilder.addParameter(new IntParameter("layer", "0"));
            messages.Add(sequenceBuilder.CurrentSequence);
        }
Beispiel #20
0
 protected static void basicRegistration(ParameterSequenceBuilder sequenceBuilder)
 {
     sequenceBuilder.addParameter(new IdParameter("collisionGroup",CollisionManager.CollideAllId.ToString()));
     SequenceParameter collisionGroups = new SequenceParameter("collisionGroups", new IdParameter("collisionGroup", CollisionManager.CollideAllId.ToString()));
     sequenceBuilder.addParameter(collisionGroups);
     sequenceBuilder.addParameter(new FloatParameter("position","0.0,0.0,0.0"));
 }
Beispiel #21
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            baseRegisterElement(sequenceBuilder);
            sequenceBuilder.addParameter(new StringParameter("model", "")); //
            sequenceBuilder.addParameter(new StringParameter("material", ""));
            sequenceBuilder.addParameter(new FloatParameter("scale","1.0,1.0,1.0"));
            ParameterSequence parameters = sequenceBuilder.CurrentSequence;

            // message
            List<ParameterSequence> messages = new List<ParameterSequence>();
            baseRegisterMessages(sequenceBuilder, messages);

            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_MODEL_MSG_ID.ToString()));
            sequenceBuilder.addParameter(new StringParameter("model", ""));
            messages.Add(sequenceBuilder.CurrentSequence);

            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_MATERIAL_MSG_ID.ToString()));
            sequenceBuilder.addParameter(new StringParameter("material", ""));
            messages.Add(sequenceBuilder.CurrentSequence);

            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_SCALE_MSG_ID.ToString()));
            sequenceBuilder.addParameter(new FloatParameter("scale", "1.0,1.0,1.0"));
            messages.Add(sequenceBuilder.CurrentSequence);

            objectBuilder.registerElement(new Constructor(), parameters, typeof(Renderable3D), "Renderable3D", messages);
        }
Beispiel #22
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="objectBuilder"></param>
 protected static void baseRegisterElement(ParameterSequenceBuilder sequenceBuilder)
 {
     sequenceBuilder.addParameter(new BoolParameter("visible", "true"));
     sequenceBuilder.addParameter(new IntParameter("layer","0"));
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, CollisionManager manager)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();

            objectBuilder.registerElement(new Constructor(manager), sequenceBuilder.CurrentSequence, typeof(CollisionDetectionElement), "CollisionDetectionElement", null);
        }
Beispiel #24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder, IInputManager inputManager, Core core)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();

            sequenceBuilder.addParameter(new BoolParameter("lastKey","false"));
            sequenceBuilder.addParameter(new BoolParameter("lastMouse", "false"));
            sequenceBuilder.addParameter(new BoolParameter("lastTouch", "false"));
            sequenceBuilder.addParameter(new BoolParameter("lastGamepad", "false"));
            sequenceBuilder.addParameter(new StringParameter("playerIndex","One"));

            CompoundParameter keymapping = new CompoundParameter("keymapping");
            keymapping.addParameter(new StringParameter("key",""));
            keymapping.addParameter(new BoolParameter("pressed", "false"));
            keymapping.addParameter(new IdParameter("downMsgId", ""));
            keymapping.addParameter(new IdParameter("upMsgId", ""));
            keymapping.addParameter(new IdParameter("target",""));
            keymapping.addParameter(new StringParameter("message", ""));
            SequenceParameter keymappings = new SequenceParameter("keymappings", keymapping);

            CompoundParameter keyboardMappings = new CompoundParameter("keyboard");
            keyboardMappings.addParameter(keymappings);
            sequenceBuilder.addParameter(keyboardMappings);

            CompoundParameter gamepadmapping = new CompoundParameter("gamepadmapping");
            gamepadmapping.addParameter(new StringParameter("key", "Start"));
            gamepadmapping.addParameter(new BoolParameter("pressed", "false"));
            gamepadmapping.addParameter(new IdParameter("downMsgId", ""));
            gamepadmapping.addParameter(new IdParameter("upMsgId", ""));
            gamepadmapping.addParameter(new IdParameter("target", ""));
            gamepadmapping.addParameter(new StringParameter("message", ""));
            SequenceParameter gamepadmappings = new SequenceParameter("gamepadmappings", gamepadmapping);

            //CompoundParameter gamepadLeftStickMapping = new CompoundParameter("leftStickMapping");
            //gamepadLeftStickMapping.addParameter(new IdParameter("movedMsgId",""));
            //gamepadLeftStickMapping.addParameter(new IdParameter("target", ""));

            //CompoundParameter gamepadRightStickMapping = new CompoundParameter("rightStickMapping");
            //gamepadRightStickMapping.addParameter(new IdParameter("movedMsgId", ""));
            //gamepadRightStickMapping.addParameter(new IdParameter("target", ""));

            CompoundParameter gamepadMappings = new CompoundParameter("gamepad");
            gamepadMappings.addParameter(gamepadmappings);
            //gamepadMappings.addParameter(gamepadLeftStickMapping);
            //gamepadMappings.addParameter(gamepadRightStickMapping);
            sequenceBuilder.addParameter(gamepadMappings);

            objectBuilder.registerElement(new Constructor(inputManager, core), sequenceBuilder.CurrentSequence, typeof(InputContext), "InputContext", null);
        }
Beispiel #25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            baseRegisterElement(sequenceBuilder);
            sequenceBuilder.addParameter(new StringParameter("font", ""));
            sequenceBuilder.addParameter(new StringParameter("text", ""));
            ParameterSequence parameters = sequenceBuilder.CurrentSequence;

            // message
            List<ParameterSequence> messages = new List<ParameterSequence>();
            baseRegisterMessages(sequenceBuilder, messages);

            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_TEXT_ID.ToString()));
            sequenceBuilder.addParameter(new StringParameter("text", ""));
            messages.Add(sequenceBuilder.CurrentSequence);

            objectBuilder.registerElement(new Constructor(), parameters, typeof(TextOverlay), "TextOverlay", messages);
        }
Beispiel #26
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new StringParameter("font", ""));
            sequenceBuilder.addParameter(new StringParameter("text", ""));
            sequenceBuilder.addParameter(new FloatParameter("offset", "0,0,0"));
            ParameterSequence parameters = sequenceBuilder.CurrentSequence;

            //// message
            //sequenceBuilder.createSequence();
            //sequenceBuilder.addParameter(new IdParameter("msgId", CHANGE_TEXT_ID.ToString()));
            //sequenceBuilder.addParameter(new StringParameter("text", ""));
            //ParameterSequence msg1 = sequenceBuilder.CurrentSequence;

            objectBuilder.registerElement(new Constructor(), parameters, typeof(ParticleSystem), "ParticleSystem", null /*new ParameterSequence[] { msg1 } */);
        }
Beispiel #27
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            sequenceBuilder.addParameter(new FloatParameter("start", "0, 0, 0"));
            sequenceBuilder.addParameter(new FloatParameter("target", "0,0,0"));
            sequenceBuilder.addParameter(new FloatParameter("time", "1.0"));
            sequenceBuilder.addParameter(new BoolParameter("swing", "true"));
            sequenceBuilder.addParameter(new BoolParameter("loop", "true"));

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(TeeterLogic3D),"TeeterLogic3D", null);
        }
Beispiel #28
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectBuilder"></param>
        public static void registerElement(IObjectBuilder objectBuilder)
        {
            ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
            sequenceBuilder.createSequence();
            basicRegistration(sequenceBuilder);
            sequenceBuilder.addParameter(new FloatParameter("center","0,0,0"));
            sequenceBuilder.addParameter(new FloatParameter("halfExtend", "0,0,0"));
            sequenceBuilder.addParameter(new FloatParameter("orientation", "0,0,0,1"));

            objectBuilder.registerElement(new Constructor(), sequenceBuilder.CurrentSequence, typeof(OrientedBoxCollider), "OrientedBoxCollider", null);
        }
Beispiel #29
0
        public IScript Compile(String scriptCode, String name)
        {
            Stack stack = new Stack();
            //System.Diagnostics.Debugger.Launch();
            XDocument script = XDocument.Parse(scriptCode.Trim());

            m_entryPoint = -1;

            m_currentProgramCode = new MemoryStream();
            m_parameterSequence = new ParameterSequence();
            XElement root = script.Element("Root");
            if (root == null)
            {
                root = script.Element("root");
                if (root == null)
                {
                    throw new Exception("Error. Script must contain a root node.");
                }
            }
            foreach (XElement node in root.Elements())
            {
                bool isMain = false;
                if (node.Name.LocalName == "Main" || node.Name.LocalName == "main")
                {
                    // scripts starts here
                    m_entryPoint = (int)m_currentProgramCode.Position;
                    // push all attributes to the parameter sequencer (so the script can run with default parameters)
                    ParameterSequenceBuilder sequenceBuilder = new ParameterSequenceBuilder();
                    sequenceBuilder.createSequence();
                    foreach (XAttribute attr in node.Attributes())
                    {
                        sequenceBuilder.addParameter(new StringParameter(attr.Name.ToString(), attr.Value));
                    }
                    m_parameterSequence = sequenceBuilder.CurrentSequence;
                    stack = new Stack(m_parameterSequence.getMemStream());
                    isMain = true;
                }
                // add node as a function
                else
                {
                    //m_dataTable.Data.Add(node.Name.LocalName, (int)m_currentProgramCode.Position);
                    m_functionTable.add(node.Name.LocalName, (int)m_currentProgramCode.Position);
                    isMain = false;
                }
                compileRoutine(node, isMain,stack);
            }

            // end of program
            m_currentProgramCode.Writer.Write((int)XmlScriptExecutor.OpCode.HALT);

            XmlScriptCompiled compiledScript = new XmlScriptCompiled(scriptCode);
            compiledScript.Name = name;
            compiledScript.ProgramCode = m_currentProgramCode;
            compiledScript.EntryPoint = m_entryPoint;
            compiledScript.ParameterSequence = m_parameterSequence;

            if (m_entryPoint == -1)
            {
                throw new Exception("Error no entrypoint for script: " + name);
            }
            return compiledScript;
        }