[Test] //update_nextのテスト public void test_update_next() { next_puyo test_target = new next_puyo(); test_target.init(); int[] color = new int[2]; bool flag = false; color[0] = test_target.get().get_color(0); color[1] = test_target.get().get_color(1); for (int i = 0; i < 10; i++) { puyopuyo ret_puyo = test_target.get(); if ((color[0] != ret_puyo.get_color(0)) || (color[1] != ret_puyo.get_color(1))) { flag = true; break; } test_target.update_next(); } Assert.AreEqual(true, flag); }
[Test] //initのテスト public void test_init() { next_puyo test_target = new next_puyo(); test_target.init(); puyopuyo ret_puyo = test_target.get(); //puyo Assert.AreNotEqual(ret_puyo, null); //puyo color for (int i = 0; i < 2; i++) { int color = ret_puyo.get_color(i); Assert.AreEqual(3, color, 3); } //puyo pos for (int i = 0; i < 2; i++) { Assert.AreEqual(0, ret_puyo.get_position(i).get_x()); Assert.AreEqual(0, ret_puyo.get_position(i).get_y()); } }
//-------------------- //fix //-------------------- public void fix(puyopuyo input_puyo) { for (int i = 0; i < 2; i++) { int color = input_puyo.get_color(i); Point pos = input_puyo.get_position(i); m_Grid[pos.get_x(), pos.get_y()] = color; } set_state(1); }
void update_next(puyopuyo next_puyo) { delete_next(); for (int i = 0; i < 2; i++) { int color = next_puyo.get_color(i); int pos_x = 8; int pos_y = 9 + i; if (color == 0) { continue; } m_displayNext[i] = Instantiate(m_PrefabPuyo[color - 1], new Vector3(pos_x, pos_y, 0), new Quaternion(0, 0, 0, 0)); } }
[Test] //copyのテスト public void test_copy_color() { puyopuyo test_target = new puyopuyo(); test_target.init(); test_target.set_color(0, 1); test_target.set_color(1, 2); puyopuyo copy_obj = new puyopuyo(); copy_obj.copy_color(test_target); for (int i = 0; i < 2; i++) { int color = copy_obj.get_color(i); Assert.AreEqual(color, i + 1); } }
[Test] //initのテスト public void test_init() { puyopuyo test_target = new puyopuyo(); test_target.init(); //color for (int i = 0; i < 2; i++) { int color = test_target.get_color(i); Assert.AreEqual(color, 0); } //pos for (int i = 0; i < 2; i++) { Assert.AreEqual(0, test_target.get_position(i).get_x()); Assert.AreEqual(0, test_target.get_position(i).get_y()); } }
void update_temp(puyopuyo temp_puyo) { delete_temp(); if (temp_puyo.is_valid() == false) { return; } for (int i = 0; i < 2; i++) { int color = temp_puyo.get_color(i); if (color == 0) { continue; } Point temp_pos = temp_puyo.get_position(i); Vector3 pos = new Vector3(temp_pos.get_x(), temp_pos.get_y(), 0); m_dislayTemp[i] = Instantiate(m_PrefabPuyo[color - 1], pos, new Quaternion(0, 0, 0, 0)); } }