public void changegameTime(int msg, string state) { PlayTime.enabled = true; Fence1.SetActive(false); Fence2.SetActive(false); Fence3.SetActive(false); Fence4.SetActive(false); gameTimeText.text = "Round " + AuctionTime.roundCount.ToString() + " : " + msg.ToString(); if (state == "game") { propelTime = 0; AuctionTime.gameState = "game"; } }
public void changeendTime(int msg, string state, string s1, string s2, string s3, string s4) { AuctionInfoItemText.enabled = false; AuctionItemImage.SetActive(true); propelTime = 1; PlayTime.enabled = false; AuctionCanvas.enabled = true; print = true; Text save1, save2, save3, save4; save1 = GameObject.Find("save1").GetComponent <Text> (); save2 = GameObject.Find("save2").GetComponent <Text> (); save3 = GameObject.Find("save3").GetComponent <Text> (); save4 = GameObject.Find("save4").GetComponent <Text> (); save1.text = s1; save2.text = s2; save3.text = s3; save4.text = s4; Fence1.SetActive(true); Fence2.SetActive(true); Fence3.SetActive(true); Fence4.SetActive(true); if (AuctionTime.roundCount < 5) { AuctionTime.roundCount++; Second.eulerAngles = new Vector3(0, 180, 0); Third.eulerAngles = new Vector3(0, 90, 0); Forth.eulerAngles = new Vector3(0, 270, 0); GameObject spawn; if (PhotonNetwork.player.ID == 1) { spawn = GameObject.Find("spawn1"); PhotonNetwork.Instantiate("FracturedStone", spawn.transform.position, Quaternion.identity, 0).transform.name = "1"; Money.text = (int.Parse(Money.text) + 10 + int.Parse(GameObject.Find("k1").GetComponent <Text> ().text) * 10).ToString(); Rigidbody a = GameObject.Find("1").GetComponent <Rigidbody> (); a.velocity = Vector3.zero; a.angularVelocity = Vector3.zero; } else if (PhotonNetwork.player.ID == 2) { spawn = GameObject.Find("spawn2"); PhotonNetwork.Instantiate("FracturedStone", spawn.transform.position, Second, 0).transform.name = "2"; Money.text = (int.Parse(Money.text) + 10 + int.Parse(GameObject.Find("k2").GetComponent <Text> ().text) * 10).ToString(); Rigidbody a = GameObject.Find("2").GetComponent <Rigidbody> (); a.velocity = Vector3.zero; a.angularVelocity = Vector3.zero; } else if (PhotonNetwork.player.ID == 3) { spawn = GameObject.Find("spawn3"); PhotonNetwork.Instantiate("FracturedStone", spawn.transform.position, Third, 0).transform.name = "3"; Money.text = (int.Parse(Money.text) + 10 + int.Parse(GameObject.Find("k3").GetComponent <Text> ().text) * 10).ToString(); Rigidbody a = GameObject.Find("3").GetComponent <Rigidbody> (); a.velocity = Vector3.zero; a.angularVelocity = Vector3.zero; } else if (PhotonNetwork.player.ID == 4) { spawn = GameObject.Find("spawn4"); PhotonNetwork.Instantiate("FracturedStone", spawn.transform.position, Forth, 0).transform.name = "4"; Money.text = (int.Parse(Money.text) + 10 + int.Parse(GameObject.Find("k4").GetComponent <Text> ().text) * 10).ToString(); Rigidbody a = GameObject.Find("4").GetComponent <Rigidbody> (); a.velocity = Vector3.zero; a.angularVelocity = Vector3.zero; } flag = true; timeCount = 20; if (PhotonNetwork.player.ID == 1) { ExitGames.Client.Photon.Hashtable hash = new ExitGames.Client.Photon.Hashtable() { { "state", "start" } }; PhotonNetwork.player.SetCustomProperties(hash); } //라운드종료시점수통합 Text k1, k2, k3, k4, sum1, sum2, sum3, sum4; k1 = GameObject.Find("k1").GetComponent <Text> (); k2 = GameObject.Find("k2").GetComponent <Text> (); k3 = GameObject.Find("k3").GetComponent <Text> (); k4 = GameObject.Find("k4").GetComponent <Text> (); sum1 = GameObject.Find("sum1").GetComponent <Text> (); sum2 = GameObject.Find("sum2").GetComponent <Text> (); sum3 = GameObject.Find("sum3").GetComponent <Text> (); sum4 = GameObject.Find("sum4").GetComponent <Text> (); int hap1, hap2, hap3, hap4; hap1 = int.Parse(sum1.text) + int.Parse(k1.text); hap2 = int.Parse(sum2.text) + int.Parse(k2.text); hap3 = int.Parse(sum3.text) + int.Parse(k3.text); hap4 = int.Parse(sum4.text) + int.Parse(k4.text); sum1.text = hap1.ToString(); sum2.text = hap2.ToString(); sum3.text = hap3.ToString(); sum4.text = hap4.ToString(); // gameTimeText.text = msg.ToString(); pmoney1.text = (int.Parse(GameObject.Find("money1p").GetComponent <Text> ().text) + 10 + int.Parse(GameObject.Find("k1").GetComponent <Text> ().text) * 10).ToString(); if (PhotonNetwork.playerList.Length > 1) { pmoney2.text = (int.Parse(GameObject.Find("money2p").GetComponent <Text> ().text) + 10 + int.Parse(GameObject.Find("k2").GetComponent <Text> ().text) * 10).ToString(); } if (PhotonNetwork.playerList.Length > 2) { pmoney3.text = (int.Parse(GameObject.Find("money3p").GetComponent <Text> ().text) + 10 + int.Parse(GameObject.Find("k3").GetComponent <Text> ().text) * 10).ToString(); } if (PhotonNetwork.playerList.Length > 3) { pmoney4.text = (int.Parse(GameObject.Find("money4p").GetComponent <Text> ().text) + 10 + int.Parse(GameObject.Find("k4").GetComponent <Text> ().text) * 10).ToString(); } k1.text = "0"; k2.text = "0"; k3.text = "0"; k4.text = "0"; gameStateTimer = "a"; } else { //game end Text k1, k2, k3, k4, sum1, sum2, sum3, sum4; k1 = GameObject.Find("k1").GetComponent <Text> (); k2 = GameObject.Find("k2").GetComponent <Text> (); k3 = GameObject.Find("k3").GetComponent <Text> (); k4 = GameObject.Find("k4").GetComponent <Text> (); sum1 = GameObject.Find("sum1").GetComponent <Text> (); sum2 = GameObject.Find("sum2").GetComponent <Text> (); sum3 = GameObject.Find("sum3").GetComponent <Text> (); sum4 = GameObject.Find("sum4").GetComponent <Text> (); int hap1, hap2, hap3, hap4; hap1 = int.Parse(sum1.text) + int.Parse(k1.text); hap2 = int.Parse(sum2.text) + int.Parse(k2.text); hap3 = int.Parse(sum3.text) + int.Parse(k3.text); hap4 = int.Parse(sum4.text) + int.Parse(k4.text); sum1.text = hap1.ToString(); sum2.text = hap2.ToString(); sum3.text = hap3.ToString(); sum4.text = hap4.ToString(); GameObject mainCam = GameObject.Find("Main Camera"); mainCam.GetComponent <Camera> ().enabled = false; mainCam = GameObject.Find("EndCamera"); mainCam.GetComponent <Camera> ().enabled = true; AuctionInfoItemText.enabled = false; AuctionItemImage.SetActive(false); propelTime = 1; PlayTime.enabled = false; AuctionCanvas.enabled = false; Text kill1, kill2, kill3, kill4; Text survive1, survive2, survive3, survive4; Text score1, score2, score3, score4; Text Rank1, Rank2, Rank3, Rank4; kill1 = GameObject.Find("killResult1").GetComponent <Text> (); kill2 = GameObject.Find("killResult2").GetComponent <Text> (); kill3 = GameObject.Find("killResult3").GetComponent <Text> (); kill4 = GameObject.Find("killResult4").GetComponent <Text> (); kill1.text = GameObject.Find("sum1").GetComponent <Text> ().text; kill2.text = GameObject.Find("sum2").GetComponent <Text> ().text; kill3.text = GameObject.Find("sum3").GetComponent <Text> ().text; kill4.text = GameObject.Find("sum4").GetComponent <Text> ().text; survive1 = GameObject.Find("surviveResult1").GetComponent <Text> (); survive2 = GameObject.Find("surviveResult2").GetComponent <Text> (); survive3 = GameObject.Find("surviveResult3").GetComponent <Text> (); survive4 = GameObject.Find("surviveResult4").GetComponent <Text> (); survive1.text = GameObject.Find("save1").GetComponent <Text> ().text; survive2.text = GameObject.Find("save2").GetComponent <Text> ().text; survive3.text = GameObject.Find("save3").GetComponent <Text> ().text; survive4.text = GameObject.Find("save4").GetComponent <Text> ().text; score1 = GameObject.Find("scoreResult1").GetComponent <Text> (); score2 = GameObject.Find("scoreResult2").GetComponent <Text> (); score3 = GameObject.Find("scoreResult3").GetComponent <Text> (); score4 = GameObject.Find("scoreResult4").GetComponent <Text> (); score1.text = (int.Parse(kill1.text) * 100 + int.Parse(survive1.text) * 150).ToString(); score2.text = (int.Parse(kill2.text) * 100 + int.Parse(survive2.text) * 150).ToString(); score3.text = (int.Parse(kill3.text) * 100 + int.Parse(survive3.text) * 150).ToString(); score4.text = (int.Parse(kill4.text) * 100 + int.Parse(survive4.text) * 150).ToString(); int p1, p2, p3, p4; p1 = int.Parse(score1.text); p2 = int.Parse(score2.text); p3 = int.Parse(score3.text); p4 = int.Parse(score4.text); int[] score = { p1, p2, p3, p4 }; int[] rank = new int[4]; int saveRank = 0; for (int i = 0; i < PhotonNetwork.playerList.Length; i++) { saveRank = 0; for (int j = 0; j < PhotonNetwork.playerList.Length; j++) { if (score [i] < score [j]) { saveRank++; } } rank [i] = saveRank + 1; } Debug.Log(PhotonNetwork.playerList.Length.ToString()); Rank1 = GameObject.Find("rankResult1").GetComponent <Text> (); Rank2 = GameObject.Find("rankResult2").GetComponent <Text> (); Rank3 = GameObject.Find("rankResult3").GetComponent <Text> (); Rank4 = GameObject.Find("rankResult4").GetComponent <Text> (); Rank1.text = rank [0].ToString() + " 등"; if (PhotonNetwork.playerList.Length >= 2) { Rank2.text = rank [1].ToString() + " 등"; } else { Rank2.text = "0"; } if (PhotonNetwork.playerList.Length >= 3) { Rank3.text = rank [2].ToString() + " 등"; } else { Rank3.text = "0"; } if (PhotonNetwork.playerList.Length >= 4) { Rank4.text = rank [3].ToString() + " 등"; } else { Rank4.text = "0"; } } }