Ejemplo n.º 1
0
    /// <summary>Promotes the piece to a given type.</summary>
    /// <param name="type">The type to promote to.</param>
    public void PromoteTo(BoardPiece.Type type)
    {
        Assert.IsTrue(type != Type.King && type != Type.Pawn, string.Format("{0} is an invalid type to promote to", type.ToString()));

        this.type = type;
        name      = string.Format("{0} (Promoted Pawn) {1}", type.ToString(), color.ToString());
        UpdateSprite();
    }
Ejemplo n.º 2
0
 /// <summary>Sets the piece up.</summary>
 /// <param name="type">The piece's type.</param>
 /// <param name="color">The piece's color.</param>
 /// <param name="x">The x-value.</param>
 /// <param name="y">The y-value.</param>
 /// <param name="automaticallyUpdateTransform">Whether the transform's position should be updated. Defaults to true.</param>
 public void SetUp(BoardPiece.Type type, Player.Color color, int x, int y, bool automaticallyUpdateTransform = true)
 {
     //set the type, color, (x, y) and name
     this.type  = type;
     this.color = color;
     SetXY(x, y, automaticallyUpdateTransform);
     name = string.Format("{0} {1}", type.ToString(), color.ToString());
     //update the sprite
     UpdateSprite();
 }