protected string ZoomCommand(string input, out bool success) { success = false; int result; if (!AlphaNumeral.StringToInt(input, out result)) { return("'" + input + "' invalid number format"); } player.cameraFocus.SetDistance(result); success = true; return("Camera Zoom set to " + input); }
protected string SetFocusTimeCommand(string input, out bool success) { success = false; // Evaluate Input int result; if (!AlphaNumeral.StringToInt(input, out result)) { return("'" + input + "' not a valid number format"); } // Set Speed player.cameraFocus.defaultMoveDuration = result; success = true; return("Focus time set to: " + input); }
protected string SetFocusSpinCommand(string input, out bool success) { success = false; // Short hand zero rotate if (input.Length == 0) { player.cameraFocus.spin = Vector3.zero; return("Camera spin stopped"); } Regex pattern = new Regex(@"\G(" + P.FLOAT + @")\s*"); MatchCollection matches = pattern.Matches(input); if (matches.Count == 0) { return("'" + input + "' invalid rotation format"); } float[] values = { 0, 0, 0 }; int i = 0; foreach (Match match in matches) { string number = match.Groups[1].Value; int result; if (!AlphaNumeral.StringToInt(number, out result)) { return("'" + result + "' invalid number format"); } values[i++] = result; if (i >= 3) { break; } } Vector3 newSpin = new Vector3(values[1] / 100f, values[0] / 100f, values[2] / 100f); player.cameraFocus.spin = newSpin; success = true; return("Camera spin set to: ( " + values[0] + " " + values[1] + " " + values[2] + " )"); }
protected string SetFocusRotateCommand(string input, out bool success) { success = false; Regex pattern = new Regex(@"\G(" + P.FLOAT + @")\s*"); MatchCollection matches = pattern.Matches(input); if (matches.Count == 0) { return("'" + input + "' invalid rotation format"); } float[] values = { 0, 0, 0 }; int i = 0; foreach (Match match in matches) { string number = match.Groups[1].Value; int result; if (!AlphaNumeral.StringToInt(number, out result)) { return("'" + result + "' invalid number format"); } values[i++] = result; if (i >= 3) { break; } } Vector3 rotate = new Vector3(values[1], values[0], values[2]); player.cameraFocus.SetRotation(rotate); success = true; return("Rotating camera..."); }