/// <summary> /// Runs the appropriate command if one is found. /// </summary> public static void RunCommand(string command) { try { string[] commands = command.Split(' '); commands[0] = commands[0].Substring(1); bool value; int number; switch (commands[0]) { case "set": switch (commands[1]) { case "background": if (int.TryParse(commands[2], out number)) { GameWorld.WorldData.BackgroundId = (byte)number; } break; case "snow": if (bool.TryParse(commands[2], out value)) { GameWorld.WorldData.IsSnowing = value; } break; case "rain": if (bool.TryParse(commands[2], out value)) { GameWorld.WorldData.IsRaining = value; } break; case "clouds": if (bool.TryParse(commands[2], out value)) { GameWorld.WorldData.HasClouds = value; } break; case "sun": if (bool.TryParse(commands[2], out value)) { GameWorld.WorldData.HasSun = value; } break; case "soundtrack": if (int.TryParse(commands[2], out number)) { GameWorld.WorldData.SoundtrackId = (byte)number; } break; case "sunlight": int r, g, b; if (int.TryParse(commands[2], out r)) { if (int.TryParse(commands[3], out g)) { if (int.TryParse(commands[4], out b)) { GameWorld.WorldData.SunLightColor = new Color(r, g, b); LevelEditor.SaveLevel(); DataFolder.EditLevel(DataFolder.CurrentLevelFilePath); } } } break; } break; } } catch (IndexOutOfRangeException) { Console.WriteLine("Command not found."); return; } }