/// <summary> /// Select two non used doors and set them as exit of the map; /// </summary> /// <param name="map">the map to get the entries on</param> /// <param name="rejectedExits">list of non used doors</param> private void ManageEntries(Map map, List <PatternPosition> rejectedExits) { // choose the exit PatternPosition exitPos = rejectedExits[0]; // get the template MapTemplate door = _doors.Find(exitPos.id); // duplicate it and change it MapTemplate exit = new MapTemplate(door); CharUtils.ReplaceAll(exit.Content, '=', 'U'); // update the map map.Place(exit, exitPos.x, exitPos.y); map.UpExit = exitPos; exitPos = rejectedExits[rejectedExits.Count - 1]; // get the template door = _doors.Find(exitPos.id); // duplicate it and change it exit = new MapTemplate(door); CharUtils.ReplaceAll(exit.Content, '=', 'D'); // update the map map.Place(exit, exitPos.x, exitPos.y); map.DownExit = exitPos; }
/// <summary> /// Replace all occurence of a character on the map by another one /// </summary> /// <param name="source">the character to replace</param> /// <param name="dest">the new character to replace with</param> public bool ReplaceAll(char source, char dest) { return(CharUtils.ReplaceAll(Content, source, dest)); }