###前提・実現したいこと
UnityとPhotonを用いて通信対戦型のテトリスを作成しています。
ブロックの移動・回転を同期することはできましたが、一列揃った時自分の画面ではブロックが一列消えても相手画面では消えない状態です。
どのようにして相手画面のブロックを消せばよいでしょうか。
###発生している問題・エラーメッセージ
なし
###該当のソースコード
C#
1public class Grid1: Photon.PunBehaviour 2{ 3 4 public static int w = 10; 5 public static int h = 20; 6 public static Transform[,] grid = new Transform[w, h]; 7 8 9 public static Vector2 roundVec2(Vector2 v) 10 { 11 return new Vector2(Mathf.Round(v.x), Mathf.Round(v.y)); 12 } 13 14 public static bool insideBorder(Vector2 pos) 15 { 16 return ((int)pos.x >= 0 && 17 (int)pos.x < w && 18 (int)pos.y >= 0); 19 } 20 21 public static void deletRow(int y) 22 { 23 for (int x = 0; x < w; ++x) 24 { 25 PhotonNetwork.Destroy(grid[x, y].gameObject); 26 27 grid[x, y] = null; 28 } 29 } 30 31 public static void decreaseRow(int y) 32 { 33 for (int x = 0; x < w; ++x) 34 { 35 if (grid[x, y] != null) 36 { 37 grid[x, y - 1] = grid[x, y]; 38 grid[x, y] = null; 39 40 grid[x, y - 1].position += new Vector3(0, -1, 0); 41 } 42 } 43 } 44 45 public static void decreaseRowAbove(int y) 46 { 47 for (int i = y; i < h; ++i) 48 decreaseRow(i); 49 } 50 51 public static bool isRowFull(int y) 52 { 53 for (int x = 0; x < w; ++x) 54 if (grid[x, y] == null) 55 return false; 56 return true; 57 } 58 59 public static void deleteFullRoes() 60 { 61 for (int y = 0; y < h; ++y) 62 { 63 if (isRowFull(y)) 64 { 65 deletRow(y); 66 decreaseRowAbove(y + 1); 67 --y; 68 } 69 } 70 }
###試したこと
DeleteRow()内でオブジェクトを削除する処理の前にPhotonNetworkを付けてみましたが、相手側の画面でオブジェクトが削除されません。
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/02 03:13
2017/11/02 04:33