// Constructor takes a String Tester object public TestMoveCreator(StringTester st) { this.start = st.start; this.direction = st.direction; this.player = st.player; gameController = st.gameController; pause = 0.01F; gameSize = gameController.gameSize; }
// Checks if string follows format and adds it to the list of tests // Param: The test string in format of colom row or diagnal and player to test string AddTest(string test) { StringTester st = ScriptableObject.CreateInstance <StringTester>(); test = st.CheckTest(test); if (test != null) { // Add to the list of commands to0 be checked testCommandList.Add(st); return(test); } return(null); }
// Runs The next Comand on Test List // Deletes Comand and updates the List and label public void RunTest() { // Check that the Scene not on the main menue if (SceneManager.GetActiveScene().buildIndex < 1 && SceneManager.GetActiveScene().buildIndex > 2) { testCommandList.Clear(); testParamString = ""; Debug.Log("Must be Playing Active Game"); return; } else if (!EditorApplication.isPlaying || EditorApplication.isPaused) { Debug.Log("Editor Application is not playing or is paused."); testCommandList.Clear(); testParamString = ""; return; } GameController gameController = GameObject.Find("GameController").GetComponent <GameController>(); // Grab the first String Test argument execute the test in the scene StringTester test = testCommandList[0]; gameController.testing = true; gameController.ResetGame(); TestMoveCreator testMoveCreator = new TestMoveCreator(test); testMoveCreator.MakeMoves(); testMoveCreator.PlayMoves(speedFloat); // Find the start of the next Test name and make a new updated list int endLine = testParamString.IndexOf('\n'); if (endLine >= 0) { testParamString = testParamString.Substring(endLine + 1); } else { testParamString = ""; } // Romove the Test that was just run if (testCommandList.Count >= 1) { testCommandList.RemoveAt(0); } }
void DoIt() { StringTester stringTester = new StringTester(checkForDigits); Console.WriteLine(stringTester("a 8 bc")); }
void DoIt() { StringTester stringTester = new StringTester(ContainsWhiteSpace); Console.WriteLine(stringTester("a bc")); }