示例#1
0
 public void MoveLeft()
 {
     if (this.TopLeft.Col <= AimSize)
     {
         this.TopLeft = new MatrixCoords(this.TopLeft.Row, 1);
     }
     else
     {
         this.TopLeft = new MatrixCoords(this.TopLeft.Row, this.TopLeft.Col - Step);
     }
 }
示例#2
0
 public void MoveDown()
 {
     if (this.TopLeft.Row >= Constants.WorldRows - 1 - (2 * AimSize))
     {
         this.TopLeft = new MatrixCoords(Constants.WorldRows - 1 - AimSize, this.TopLeft.Col);
     }
     else
     {
         this.TopLeft = new MatrixCoords(this.TopLeft.Row + Step, this.TopLeft.Col);
     }
 }
示例#3
0
 public void MoveRight()
 {
     if (this.TopLeft.Col >= (Constants.WorldCols * Constants.LeftRightScreenRatio) - (2 * AimSize))
     {
         this.TopLeft = new MatrixCoords(
             this.TopLeft.Row,
             (int)(Constants.WorldCols * Constants.LeftRightScreenRatio) - AimSize);
     }
     else
     {
         this.TopLeft = new MatrixCoords(this.TopLeft.Row, this.TopLeft.Col + Step);
     }
 }
        public MatrixCoords GetRandomMatrixCoords()
        {
            var position = new MatrixCoords(random.Next(1, Constants.WorldRows - 1), random.Next(1, (int)(Constants.WorldCols * Constants.LeftRightScreenRatio)));

            while (this.gameObjects.Any(go => go.TopLeft == position))
            {
                position = new MatrixCoords(random.Next(1, Constants.WorldRows - 1), random.Next(1, (int)(Constants.WorldCols * Constants.LeftRightScreenRatio)));
            }

            return position;
        }
示例#5
0
 public void MoveUp()
 {
     if (this.TopLeft.Row <= AimSize)
     {
         this.TopLeft = new MatrixCoords(1, this.TopLeft.Col);
     }
     else
     {
         this.TopLeft = new MatrixCoords(this.TopLeft.Row - Step, this.TopLeft.Col);
     }
 }
 protected GameObject(MatrixCoords topLeft)
 {
     this.TopLeft = topLeft;
     this.IsDestroyed = false;
 }
        private MatrixCoords GetRandomMatrixCoords()
        {
            var position = new MatrixCoords(random.Next(1, Constants.WorldRowsWPF - 1), random.Next(1, (int)(Constants.WorldColsWPF)));
            while (this.gameObjects.Any(go => go.TopLeft == position))
            {
                position = new MatrixCoords(random.Next(1, Constants.WorldRowsWPF - 1), random.Next(1, (int)(Constants.WorldColsWPF)));
            }

            return position;
        }
 protected GameObject(MatrixCoords topLeft)
 {
     this.TopLeft     = topLeft;
     this.IsDestroyed = false;
 }