Exemplo n.º 1
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;
        }