예제 #1
0
    // Update is called once per frame
    void Update()
    {
        //countdownText.text = ("Time Left: \n " + timeLeft + " seconds");

        //if (timeLeft <= 0)
        //{
        //    StopCoroutine("LoseTime");
        //    countdownText.text = "Time's up!";
        //}

        if (_foreignMoveCompleted)
        {
            if (_core.IsMoveAllowed(_awaitMoveX, _awaitMoveY, _awaitMoveDirection))
            {
                GameObject movingPiece = _core.Board[_awaitMoveX, _awaitMoveY];
                _capturedPiece = _core.MakeMove(_awaitMoveX, _awaitMoveY, _awaitMoveDirection);
                _core.MoveCoordinates(ref _awaitMoveX, ref _awaitMoveY, _awaitMoveDirection, isWhiteTurn);
                selectedToken = movingPiece.GetComponent <Token>();

                MoveToken(_awaitMoveX, _awaitMoveY, tilePositionX[_awaitMoveX], tilePositionZ[_awaitMoveY]);
            }
            _foreignMoveCompleted = false;
            gameMode = PlayerType.Local;
        }

        string sceneName = SceneManager.GetActiveScene().name;

        if (sceneName == "Online_Game")
        {
            _connectionTester = _connectionTester++ % 4500;
            if (!netController._waitingForResponse && _connectionTester == 4499)
            {
                netController.CheckConnection();
            }
            else if (netController._waitingForResponse)
            {
                SetTimeoutPanelToActive();
            }
        }
    }