void MoveOn() { if (secondPlayerTuzNumber != null) { secondPlayerKazan.UpdateCount(secondPlayerTuzNumber.GetCount()); secondPlayerTuzNumber.AllKazan(secondPlayerKazan, canvas, secondPlayerKazan.GetPanel()); } if (firstPlayerTuzNumber != null) { firstPlayerKazan.UpdateCount(firstPlayerTuzNumber.GetCount()); firstPlayerTuzNumber.AllKazan(firstPlayerKazan, canvas, firstPlayerKazan.GetPanel()); } if (lastAleolus.GetCount() % 2 == 0) { if (firstOrSecondPlayer) { if (!firstPlayerAlveolus.Contains(lastAleolus)) { firstPlayerKazan.UpdateCount(lastAleolus.GetCount()); lastAleolus.AllKazan(firstPlayerKazan, canvas, firstPlayerKazan.GetPanel()); } } else { if (!secondPlayerAlveolus.Contains(lastAleolus)) { secondPlayerKazan.UpdateCount(lastAleolus.GetCount()); lastAleolus.AllKazan(secondPlayerKazan, canvas, secondPlayerKazan.GetPanel()); } } } else if (lastAleolus.GetCount() == 3 && lastAleolus.GetNumber() != 9) { if (firstOrSecondPlayer && !firstPlayerTuz && !firstPlayerAlveolus.Contains(lastAleolus)) { if (secondPlayerTuzNumber == null) { lastAleolus.HasTuz(whiteColor); firstPlayerTuz = true; firstPlayerTuzNumber = lastAleolus; secondPlayerKazan.UpdateCount(firstPlayerTuzNumber.GetCount()); firstPlayerTuzNumber.AllKazan(secondPlayerKazan, canvas, secondPlayerKazan.GetPanel()); tuzPanel.SetActive(true); tuzText.text = "Белые объявляют лунку№" + firstPlayerTuzNumber.GetNumber() + " тузом!"; } else if (secondPlayerTuzNumber.GetNumber() != lastAleolus.GetNumber()) { lastAleolus.HasTuz(whiteColor); firstPlayerTuz = true; firstPlayerTuzNumber = lastAleolus; secondPlayerKazan.UpdateCount(firstPlayerTuzNumber.GetCount()); firstPlayerTuzNumber.AllKazan(secondPlayerKazan, canvas, secondPlayerKazan.GetPanel()); tuzPanel.SetActive(true); tuzText.text = "Белые объявляют лунку№" + firstPlayerTuzNumber.GetNumber() + " тузом!"; } } else if (!firstOrSecondPlayer && !secondPlayerTuz && !secondPlayerAlveolus.Contains(lastAleolus)) { if (firstPlayerTuzNumber == null) { lastAleolus.HasTuz(blackColor); secondPlayerTuz = true; secondPlayerTuzNumber = lastAleolus; secondPlayerKazan.UpdateCount(secondPlayerTuzNumber.GetCount()); secondPlayerTuzNumber.AllKazan(secondPlayerKazan, canvas, secondPlayerKazan.GetPanel()); tuzPanel.SetActive(true); tuzText.text = "Черные объявляют лунку№" + secondPlayerTuzNumber.GetNumber() + " тузом!"; } else if (firstPlayerTuzNumber.GetNumber() != lastAleolus.GetNumber()) { lastAleolus.HasTuz(blackColor); secondPlayerTuz = true; secondPlayerTuzNumber = lastAleolus; secondPlayerKazan.UpdateCount(secondPlayerTuzNumber.GetCount()); secondPlayerTuzNumber.AllKazan(secondPlayerKazan, canvas, secondPlayerKazan.GetPanel()); tuzPanel.SetActive(true); tuzText.text = "Черные объявляют лунку№" + secondPlayerTuzNumber.GetNumber() + " тузом!"; } } } if (firstOrSecondPlayer) { firstOrSecondPlayer = false; } else { firstOrSecondPlayer = true; } move = false; tempAlveolus = null; if (firstOrSecondPlayer) { hodPanel.SetActive(true); hodText.text = "Ходит игрок за белых, " + whiteName; } else { hodPanel.SetActive(true); hodText.text = "Ходит игрок за черных, " + blackName; } Invoke("off", 2.0f); }
public void SelectBtn() { if (tempAlveolus != null && !move) { tempAlveolus.DeselectBTN(); move = true; count = tempAlveolus.GetCount(); number = tempAlveolus.GetNumber(); if (firstOrSecondPlayer) { if (count == 1) { if (number != 9) { foreach (Alveolus alveolus in firstPlayerAlveolus) { if (alveolus.GetNumber() == number + 1) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; } } } else { foreach (Alveolus alveolus in secondPlayerAlveolus) { if (alveolus.GetNumber() == 1) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; } } } } else if (count > 1) { foreach (Alveolus alveolus in firstPlayerAlveolus) { if (count > 0) { if (alveolus.GetNumber() >= number) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } } } foreach (Alveolus alveolus in secondPlayerAlveolus) { if (count > 0) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } Debug.Log(count + ", " + alveolus.GetNumber()); } if (count > 0) { foreach (Alveolus alveolus in firstPlayerAlveolus) { if (count > 0) { if (alveolus.GetNumber() >= number) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } } } } if (count > 0) { foreach (Alveolus alveolus in secondPlayerAlveolus) { if (count > 0) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } Debug.Log(count + ", " + alveolus.GetNumber()); } } } Invoke("MoveOn", 3.0f); } else { if (count == 1) { if (number != 9) { foreach (Alveolus alveolus in secondPlayerAlveolus) { if (alveolus.GetNumber() == number + 1) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; } } } else { foreach (Alveolus alveolus in firstPlayerAlveolus) { if (alveolus.GetNumber() == 1) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; } } } } else { foreach (Alveolus alveolus in secondPlayerAlveolus) { if (count > 0) { if (alveolus.GetNumber() >= number) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } } } foreach (Alveolus alveolus in firstPlayerAlveolus) { if (count > 0) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } } if (count > 0) { foreach (Alveolus alveolus in secondPlayerAlveolus) { if (count > 0) { if (alveolus.GetNumber() >= number) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } } } } if (count > 0) { foreach (Alveolus alveolus in firstPlayerAlveolus) { if (count > 0) { alveolus.UpdateBtn(tempAlveolus.LastElement(), canvas); lastAleolus = alveolus; count--; } Debug.Log(count + ", " + alveolus.GetNumber()); } } } Invoke("MoveOn", 3.0f); } } }