public void Apply()
    {
        var fieldCount  = 15;
        var columnCount = 5;

        if (transform.childCount != fieldCount)
        {
            Debug.LogError("자식 트랜스폼의 갯수가 15가 아닙니다.");
            return;
        }

        var rowCount  = fieldCount / columnCount;
        var xMidIndex = columnCount / 2;
        var yMidIndex = rowCount / 2;

        for (var i = 0; i < fieldCount; ++i)
        {
            var child     = transform.GetChild(i);
            var xIndex    = i % columnCount;
            var yIndex    = i / columnCount;
            var xPosition = (xIndex - xMidIndex) * Gap;
            var yPosition = (yMidIndex - yIndex) * Gap;
            child.localPosition = new Vector3(xPosition, yPosition, 0);
        }
    }
Exemple #2
0
    public void ConnectServer(PLAY_TYPE type, string serverAddr, int port, string playerSessionId)
    {
        LastMatchInfo = new MatchInfo()
        {
            ServerAddress     = serverAddr,
            Port              = port,
            PlayerGameSession = playerSessionId,
            PlayType          = type,
        };

        if (type == PLAY_TYPE.BATTLE)
        {
            GameStateManager.Get().MoveInGameBattle();
        }
        else if (type == PLAY_TYPE.CO_OP)
        {
            GameStateManager.Get().MoveInGameCoop();
        }
        else
        {
            Debug.LogError($"지원하지 않는 모드로 서버 접속 요청이 들어왔습니다. {type.ToString()}");
        }
    }