Ejemplo n.º 1
0
        private void LoadScene(Node root, World world)
        {
            Identifier iden = _tplSceneUnified.GetMatchingIdentifier(root);
            if (iden == null)
                throw new Exception(String.Format("Could not find identifier {0} in script", _tplSceneUnified.Identity[0]));
            Scene scene = CreateScene(iden, world, null);

            Node subs = root.GetNode("subs");
            if (subs != null)
            {
                foreach (Variable v in subs)
                {
                    iden = v as Identifier;
                    if (_tplSceneUnified.ValidateIdentifier(iden))
                        CreateScene(iden, world, scene);
                    else
                        Logger.Warn("Unrecognized variable named \"{0}\" in sub-scene node", v.Name);
                }
            }
        }
Ejemplo n.º 2
0
        private World LoadNode(Node root)
        {
            IntVariable ivar = (IntVariable)_tplWorldSNO.GetMatchingValue(root);
            if (ivar == null)
                throw new Exception(String.Format("Could not find value {0} in script", _tplWorldSNO.Identity[0]));
            World world = new World(this.Game, ivar.Value);

            Identifier iden = _tplStartPos.GetMatchingIdentifier(root);
            if (iden == null)
                throw new Exception(String.Format("Could not find identifier {0} in script", _tplStartPos.Identity[0]));
            world.StartPosition.X = iden.GetFloat(0).Value;
            world.StartPosition.Y = iden.GetFloat(1).Value;
            world.StartPosition.Z = iden.GetFloat(2).Value;

            string name = "scenes";
            Node node = root.GetNode(name, false);
            if (node == null)
                throw new Exception(String.Format("Could not find node {0} in script", name));
            LoadWorldScenes(node, world);
            world.SortScenes();
            return world;
        }