public void MoveUp_MoveRacketOneUp() { Vector2 _expected = new Vector2(0, 1); racketController.MoveUp(); Assert.AreEqual(_expected, racketController.GetPosition()); }
void inPlayUpdate() { // InPlayの状態の時はBallControllerからSetBallOutを呼び出されると状態が変わる。この中では状態は変わらない。 // ボールの位置を取得 Vector3 ballPos = new Vector3(0, 0, 0); Quaternion ballDir = new Quaternion(0, 0, 0, 0); ballController.GetPosition(ref ballPos, ref ballDir); // ボールの速度を取得 Vector3 ballSpeed = new Vector3(); BallInstance.GetComponent <BallController>().GetSpeed(ref ballSpeed); // ラケットの位置と方向を取得 Vector3 racketPos = new Vector3(0, 0, 0); Quaternion racketDir = new Quaternion(0, 0, 0, 0);; racketController.GetPosition(ref racketPos, ref racketDir); // ラケットの中央位置を取得 Vector3 racketCenterPos = RacketCenter.GetComponent <Transform>().position; // デバッグ用.ボールの前にラケットを転移 if (Input.GetKeyDown("space")) { print("space pressed"); float timeConst = 0.03f; Vector3 offset = racketCenterPos - racketPos; Vector3 newRacketPos = ballPos + ballSpeed * timeConst - offset; print(racketPos); racketController.setPosition(newRacketPos, racketDir); } // デバッグ用.zキーでゾーンモード if (Input.GetKeyDown("z")) { enterZone(); } if (Input.GetKeyUp("z")) { exitZone(); } // プレイ履歴に記録 MyTrace tr = new MyTrace(); tr.ballPos = ballPos; tr.racketPos = racketPos; tr.racketDir = racketDir; tr.racketCenterPos = racketCenterPos; tr.time = timeElapsed; Trace.Add(tr); timeElapsed += Time.deltaTime; // BallをDATAへ記録 RecordData("200 BALL_POS: " + ballPos.x + "," + ballPos.y + "," + ballPos.z + "," + ballSpeed.x + "," + ballSpeed.y + "," + ballSpeed.z); // RacketをDATAへ記録 RecordData("210 RCKT_POS: " + racketCenterPos.x + "," + racketCenterPos.y + "," + racketCenterPos.z + "," + racketDir.eulerAngles.x + "," + racketDir.eulerAngles.y + "," + racketDir.eulerAngles.z); }
public Vector2 GetPosition() { return(racketController.GetPosition()); }