void Update() { // if (isServer) playerNo = BattlefieldUI.playerNo; Debug.Log(BattlefieldUI.playerNo + " " + BattlefieldUI.preparePlayerNo + " " + BattlefieldUI.deadPlayerNo); if (isServer) { BattlefieldUI.playerNo = NetworkUI.manager.numPlayers; } if (isLocalPlayer && !isDead) { transform.Find("Head").GetComponent <RawImage>().color = m_colorBlue; } if (BattlefieldUI.startFlag == false) { return; } //playerDataText.text = GetComponent<NetworkIdentity>().netId.ToString(); //playerNameText.text = playerID.ToString(); //playerDataText.text = playerData.ToString(); playerScoreText.GetComponent <Text>().text = "P" + playerID.ToString() + ":" + (bodyLength - 3).ToString(); if (bodyLength > NetworkUI.highestScore) { NetworkUI.highestScore = bodyLength; NetworkUI.highestPlayerID = playerID; } if (isDead) { return; } Transform temp_Head = transform.Find("Head").transform; if (temp_Head.localPosition.x < 0 || temp_Head.localPosition.y > 0 || temp_Head.localPosition.x >= 800 || temp_Head.localPosition.y <= -800) { goToDeath(); } if (isDead) { return; } playerScoreText.GetComponent <Text>().color = Color.black; if (isLocalPlayer == false) { return; } for (int i = 0; i <= 3; i++) { if (Input.GetKeyDown(keyCodeArray[i])) { if (i == 3 - playerData) { break; } cdTimer.ResetDuration(0.1f); cdTimer.StopOnce(); judgeAndRun(i); isKeyDown = true; return; } if (Input.GetKeyUp(keyCodeArray[i])) { cdTimer.ResetDuration(0.5f); isKeyDown = false; } if (Input.GetKey(keyCodeArray[i])) { if (i == 3 - playerData) { break; } Debug.Log(i); cdTimer.ResetDuration(0.1f); isKeyDown = true; judgeAndRun(i); } } if (!cdTimerFlag && BattlefieldUI.startFlag) { AudioManager.Instance.PlayMusic(5); cdTimer = new CountDownTimer(0.5f); cdTimerFlag = true; if (!cdTimer_been_Flag && isServer) { cdTimer_been = new CountDownTimer(3.0f); cdTimer_been_Flag = true; } GameObject.Find("startButton").gameObject.SetActive(false); } if (isServer && cdTimer_been.IsTimeUp) { cdTimer_been.Start(); int x = (int)Random.Range(1.0f, 50.0f); int y = (int)Random.Range(1.0f, 50.0f); RpcCreateBeen(x, y); } if (isKeyDown) { return; } judgeAndRun(playerData); }