Beispiel #1
0
 public Skier(FieldCoordinates topLeft)
     : base(topLeft, new char[, ] {
     { '|', '|' }
 })
 {
     this.IsDead = false;
 }
Beispiel #2
0
        // 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];
                    }
                }
            }
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
 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;
     }
 }
Beispiel #6
0
 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;
     }
 }
Beispiel #7
0
 public Obstacle(FieldCoordinates topLeft, char[,] body)
     : base(topLeft, body)
 {
 }
Beispiel #8
0
        //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);
        }
Beispiel #9
0
 public Obstacle(FieldCoordinates topLeft, char[,] body)
     : base(topLeft, body)
 {
 }
Beispiel #10
0
 public Bonus(FieldCoordinates topLeft)
     : base(topLeft, flag)
 {
 }
Beispiel #11
0
 public Decoration(FieldCoordinates topLeft)
     : base(topLeft, new char[, ] {
     { '*' }
 })
 {
 }
Beispiel #12
0
 public Bonus(FieldCoordinates topLeft)
     : base(topLeft, flag)
 {
 }
Beispiel #13
0
 public Skier(FieldCoordinates topLeft)
     : base(topLeft, new char[,] { { '|', '|' } })
 {
     this.IsDead = false;
 }
Beispiel #14
0
 public Decoration(FieldCoordinates topLeft)
     : base(topLeft, new char[,] { { '*' } })
 {
 }