Exemple #1
0
    void Awake()
    {
        if (control == null)
        {
            control = GameObject.Find("board").GetComponent <SystemControl>();
        }

        netPlayer = transform.parent.gameObject.GetComponent <NetPlayer>();

        if (!chessMap.ContainsKey(gameObject.name))
        {
            chessMap.Add(gameObject.name, gameObject);
        }
        else
        {
            chessMap[gameObject.name] = gameObject;
        }

        coord.Set(initCoordRow, initCoordCol);

        switch (chessTypeId)
        {
        case ChessTypeId.Empty:
            chessType = Empty.GetChessType();
            break;

        case ChessTypeId.JIANG:
            chessType = JIANG.GetChessType();
            break;

        case ChessTypeId.SHI:
            chessType = SHI.GetChessType();
            break;

        case ChessTypeId.XIANG:
            chessType = XIANG.GetChessType();
            break;

        case ChessTypeId.MA:
            chessType = MA.GetChessType();
            break;

        case ChessTypeId.CHE:
            chessType = CHE.GetChessType();
            break;

        case ChessTypeId.PAO:
            chessType = PAO.GetChessType();
            break;

        case ChessTypeId.BING:
            chessType = BING.GetChessType();
            break;

        default:
            chessType = Empty.GetChessType();
            break;
        }
    }