public void Setup(Sprite pieceSprite, Color32 pieceColor, ChessPiece chessPiece, PromotionModalBox promotionBox)
    {
        transform.GetComponent <SpriteRenderer>().sortingLayerName = "PiecesLayer";
        mySprite = pieceSprite;
        transform.GetComponent <SpriteRenderer>().sprite = mySprite;

        myPieceColor = pieceColor;
        transform.GetComponent <SpriteRenderer>().color = myPieceColor;

        myChessPiece = chessPiece;
        myParentBox  = promotionBox;
    }
Beispiel #2
0
    private void CreatePawnPromotionModalBox()
    {
        float myYCoordinate;

        myYCoordinate = transform.position.y - 3f;

        if (myPlayerColorTag == "Dark")
        {
            myYCoordinate = transform.position.y + 3f;
        }

        GameObject modalBox = Instantiate(promotionModalBoxPrefab, new Vector3(transform.position.x, myYCoordinate, -5f), Quaternion.Euler(0, 0, 90f), transform);

        myModalBox = modalBox.GetComponent <PromotionModalBox>();
        myModalBox.GetComponent <SpriteRenderer>().sortingLayerName = "PiecesLayer";

        myModalBox.SetupPromotionalModalBox(this, spritePieceSet);
        myChessSet.SetPawnPromotingState(true);
    }