Difference between revisions of "2021 - BarronPiece"
(Created page with "=Actual Code= <syntaxhighlight lang=c#> class BaronPiece : Piece { public BaronPiece(bool player1) : base(player1) { pieceType...") |
(→Things to note) |
||
Line 24: | Line 24: | ||
Constructor runs the base constructor as well as setting peiceType & VPValue. | Constructor runs the base constructor as well as setting peiceType & VPValue. | ||
− | CheckMoveIsValid is overriden in this sub class. | + | CheckMoveIsValid is overriden in this sub class, because each piece has different rules for movement. |
Latest revision as of 09:28, 3 September 2020
Actual Code
class BaronPiece : Piece
{
public BaronPiece(bool player1)
: base(player1)
{
pieceType = "B";
VPValue = 10;
}
public override int CheckMoveIsValid(int distanceBetweenTiles, string startTerrain, string endTerrain)
{
if (distanceBetweenTiles == 1)
{
return fuelCostOfMove;
}
return -1;
}
}
Things to note
Constructor runs the base constructor as well as setting peiceType & VPValue.
CheckMoveIsValid is overriden in this sub class, because each piece has different rules for movement.