Ejemplo n.º 1
0
    void CreateFigure(GameObject chessType, int posY, int posX, Transform parent, TypeTeam team, bool _before = false)
    {
        GameObject figure   = Instantiate(chessType, parent);
        Vector3    position = boardsTile[posY, posX].transform.position;

        position.z = 0;
        figure.transform.position   = position;
        figure.transform.localScale = new Vector3(scale * .8f, scale * .8f, 1);
        ChessFigure tempChess = figure.GetComponent <ChessFigure>();

        tempChess.Init(new Vector2Int(posY, posX), team, _before);
        tempChess.OnClick  += ChooseTurn;
        figures[posY, posX] = tempChess;
    }
Ejemplo n.º 2
0
    ChessFigure GetFromListSaveFifures(SaveFigure temp, Transform parent)
    {
        GameObject figure      = temp.team == TypeTeam.white ? chessTypeOne[(int)temp.type] : chessTypeTwo[(int)temp.type];
        GameObject chessFigure = Instantiate(figure, parent);

        chessFigure.transform.position   = new Vector3(temp.positionX, temp.positionY, temp.positionZ);
        chessFigure.transform.localScale = new Vector3(scale * .8f, scale * .8f, 1);
        ChessFigure tempChess = chessFigure.GetComponent <ChessFigure>();

        tempChess.Init(new Vector2Int(temp.posX, temp.posY), temp.team, temp.beforeFigure);
        tempChess.startPos     = new Vector2Int(temp.startPosX, temp.startPosY);
        tempChess.id           = temp.id;
        tempChess.turnCounter  = temp.turnCounter;
        tempChess.enable       = temp.enable;
        tempChess.beforeFigure = temp.beforeFigure;
        tempChess.OnClick     += ChooseTurn;
        return(tempChess);
    }