public Skier(FieldCoordinates topLeft) : base(topLeft, new char[, ] { { '|', '|' } }) { this.IsDead = false; }
// Image is combination of all object`s symbols public void EnqueueForRendering(IRenderable obj) { char[,] objImage = obj.GetImage(); int imageRows = objImage.GetLength(0); int imageCols = objImage.GetLength(1); // Set the image in top-left corner FieldCoordinates objTopLeft = obj.GetTopLeft(); // Move the image to his position int lastRow = Math.Min(objTopLeft.Row + imageRows, this.renderMatrixRows); int lastCol = Math.Min(objTopLeft.Col + imageCols, this.renderMatrixCols); for (int row = obj.GetTopLeft().Row; row < lastRow; row++) { for (int col = obj.GetTopLeft().Col; col < lastCol; col++) { // Check if the object coordinates are in the fields if (row >= 0 && row < renderMatrixRows && col >= 0 && col < renderMatrixCols) { renderMatrix[row, col] = objImage[row - obj.GetTopLeft().Row, col - obj.GetTopLeft().Col]; } } } }
protected GameObject(FieldCoordinates topLeft, char[,] body) { this.TopLeft = topLeft; int imageRows = body.GetLength(0); int imageCols = body.GetLength(1); this.body = this.CopyBodyMatrix(body); this.IsHit = false; this.IsGone = false; }
public Tree(FieldCoordinates topLeft, int option) : base(topLeft, smallTree) { if (option == 2) { base.body = bigTree; } else if (option == 3) { base.body = rock; } else if (option == 1) { base.body = smallTree; } }
public Obstacle(FieldCoordinates topLeft, char[,] body) : base(topLeft, body) { }
//Allows comparing of values instead of addresses only (same object vs. same value) public override bool Equals(object obj) { FieldCoordinates objAsMatrixCoords = obj as FieldCoordinates; return(objAsMatrixCoords.Row == this.Row && objAsMatrixCoords.Col == this.Col); }
public Bonus(FieldCoordinates topLeft) : base(topLeft, flag) { }
public Decoration(FieldCoordinates topLeft) : base(topLeft, new char[, ] { { '*' } }) { }
public Skier(FieldCoordinates topLeft) : base(topLeft, new char[,] { { '|', '|' } }) { this.IsDead = false; }
public Decoration(FieldCoordinates topLeft) : base(topLeft, new char[,] { { '*' } }) { }