/// <summary> /// Loads the game config from a config file /// This will also load the default level /// </summary> /// <param name="filename">The name of the config file to load</param> public void LoadConfigFromFile(string filename) { WriteDebugLine("BEGIN LOADING CONFIG FILE",true); //Load config and default level mCurrentConfiguration = GeneralConfig.LoadFromFile(filename); WriteDebugLine("Loaded Config from " + filename); mLevel = LevelData.Load(mCurrentConfiguration.DefaultLevel); WriteDebugLine("Loaded Level from " + mCurrentConfiguration.DefaultLevel); mMap = LevelMapData.LoadFromFile(mLevel.LevelMapFileName); WriteDebugLine("Loaded Map from " + mLevel.LevelMapFileName); //Create pathfinding graph for level mGraph = LevelMapGraph.NewGraphFromMap(mMap); WriteDebugLine("Created pathfinding graph from map"); //Add config to scripting mScripter.LoadAndImportFromInstance(mCurrentConfiguration,out mBuffer); WriteDebugLine("Imported Config into Scripting Engine: " + mBuffer); WriteDebugLine("END LOADING CONFIG FILE"); }
/// <summary> /// Generate and initialise a new random square map and graph. /// </summary> /// <param name="Dimention">The side length of the square map.</param> public void GenerateNewRandomSquareMap(int Dimention, int wallstobreak) { mMap = RandomMapGenerator.RandomSquareLevelMap(Dimention, null, wallstobreak); mGraph = LevelMapGraph.NewGraphFromMap(mMap); }