private IEnumerator CheckState() { checkingBool = sChecker.CheckState(); Debug.Log("checkingbool : " + checkingBool); if (!checkingBool) { //jos tsekki oli valetta, palauta pallot while (targetedObject.transform.position != originalPosition) { targetedObject.transform.position = Vector3.MoveTowards(targetedObject.transform.position, originalPosition, (speed * Time.deltaTime)); otherTargetedObject.transform.position = Vector3.MoveTowards(otherTargetedObject.transform.position, otherOriginalPosition, (speed * Time.deltaTime)); yield return(new WaitForEndOfFrame()); } targetedObject.GetComponent <LocationHolder>().SetX(moveX); targetedObject.GetComponent <LocationHolder>().SetY(moveY); otherTargetedObject.GetComponent <LocationHolder>().SetX(otherX); otherTargetedObject.GetComponent <LocationHolder>().SetY(otherY); } checkingBool = false; }
public void CheckStateTest_ShouldReturn1() { var lineList = new List <LineStructure> { new LineStructure() { X1 = 0, Y1 = 0, X2 = 10, Y2 = 0, StrokeColor = _red }, new LineStructure() { X1 = 10, Y1 = 0, X2 = 20, Y2 = 0, StrokeColor = _blue }, new LineStructure() { X1 = 0, Y1 = 10, X2 = 10, Y2 = 10, StrokeColor = _red }, new LineStructure() { X1 = 10, Y1 = 10, X2 = 20, Y2 = 10, StrokeColor = _blue }, new LineStructure() { X1 = 0, Y1 = 20, X2 = 10, Y2 = 20, StrokeColor = _red }, new LineStructure() { X1 = 0, Y1 = 0, X2 = 0, Y2 = 10, StrokeColor = _white }, new LineStructure() { X1 = 10, Y1 = 0, X2 = 10, Y2 = 10, StrokeColor = _white }, new LineStructure() { X1 = 20, Y1 = 0, X2 = 20, Y2 = 10, StrokeColor = _blue }, new LineStructure() { X1 = 10, Y1 = 10, X2 = 10, Y2 = 20, StrokeColor = _blue } }; var refLine = new LineStructure() { X1 = 0, Y1 = 10, X2 = 0, Y2 = 20, StrokeColor = _white }; var stateChecker = new StateChecker() { GameHeight = 10, GameWidth = 10 }; int actual = stateChecker.CheckState(refLine, lineList).Item2; int expected = 1; Assert.IsTrue(actual == expected); }