private void Update() { if (AnimCollection.IsAnim()) { return; } if (MapData.GameJudge == -1 && !IsInvoking("MapReset")) { Invoke("MapReset", 1.5f); } else if (MapData.GameJudge == 1 && !IsInvoking("MapNext")) { Particle.AddParticle(new Vector2(0, 0), 3); Invoke("MapNext", 1.5f); } }
private static void JudgeGame(int h1, int w1, int h2, int w2) { int p1 = Blocks[h1, w1], p2 = Blocks[h2, w2]; // Blocks[h1, w1] - 기존의 위치(p1) // Blocks[h2, w2] - 이동하려는 위치(p2) Vector2 v = new Vector2( (w2 - NowMap.HalfWidth) * NowMap.ModificSize, (h2 - NowMap.HalfHeight) * NowMap.ModificSize); if (p1 == 1 && p2 == 3) { // 게임 클리어 if (GameJudge == 0) { GameJudge = 1; } } else if (p1 + p2 > 2) // 유저와 분신, 분신과 분신이 만났을 때 { // 게임 오버 int c = (p1 == 1 || p2 == 1) ? 0 : (p2 == 3) ? 2 : 1; Particle.AddParticle(v, c); GameJudge = -1; } Blocks[h1, w1] = 0; Blocks[h2, w2] = p1; for (int k = 0; k < BlockObj.Count; k++) { if (BlockObj[k].name != h1 + "," + w1) { continue; } BlockObj[k].name = h2 + "," + w2; BlockObj[k].GetComponent <MoveBlock>().Move(w2, h2, v); } }