Example #1
0
        public Overworld(ContentManager Content, Game1 game, Player p, string current = null)
        {
            this.game    = game;
            this.Content = Content;
            ui           = new UiSystem();
            player       = new OWPlayer(Content, p, Vector2.Zero);

            // load map
            overworldLua = new Lua();
            overworldLua.LoadCLRPackage();
            overworldLua.DoString("import ('Lakeside2', 'Lakeside2')");
            overworldLua["player"]    = p;
            overworldLua["overworld"] = this;
            LuaScript locationScript = new LuaScript("map.lua");

            locationScript.execute(null, overworldLua);

            // put player in the correct spot (the area they're coming out of)
            if (current == null)
            {
                index = 0;
            }
            else
            {
                for (int i = 0; i < locations.Count; i++)
                {
                    if (locations[i].filename == current)
                    {
                        index = i; break;
                    }
                }
            }

            // physically move player to index, set camera
            setPlayerLocation();
            x = getCameraDesired();

            ui.addStripeElement(new UiObjectMonitor <List <OWLocation> >(locations, locs =>
            {
                return(Path.GetFileNameWithoutExtension(locs[index].filename));
            }), StripePosition.Center);
        }