public void TestSetPosition() { BaseGamePiece TestCard = new BaseGamePiece(20, 20, 0, 0, 0); TestCard.SetPosition(19, 13, 22); MPoint3D NewPosition = new MPoint3D(19, 13, 22); Assert.IsTrue(TestCard.GetPosition().Equals(NewPosition)); }
// Associations /// <summary> /// </summary> //public ArrayList assignedPoint; // Operations /// <summary> /// This is either a math expression, or the name of the image file to draw. /// </summary> /// <param name="contentToDraw"> /// This either the name of the image file (without a file extension), or a math expression. /// </param> /// <param name="isContentToDrawAMathExpression"> /// If this is set to true, then the contentToDraw is a math expression. Otherwise, it is the name of an image file included for this project. /// </param> /// <param name="widthOfThisGamePiece"> /// The width of the container rectangle of this game piece. /// </param> /// <param name="heightOfGamePiece"> /// The height of the rectangle enclosing this game-piece. /// </param> /// <param name="xPos"> /// The x-coordinate of the top left corner of this GamePiece displayed on the screen. /// </param> /// <param name="yPos"> /// The y-coordinate of the top left corner of this GamePiece displayed on the screen. /// </param> /// <param name="zPos"> /// The z-coordinate of the top left corner of this GamePiece displayed on the screen. /// </param> /// <returns> /// </returns> public BaseGamePiece(int widthOfThisGamePiece, int heightOfGamePiece, float xPos, float yPos, float zPos) { this.Position = new MPoint3D(xPos, yPos, zPos); if ((widthOfThisGamePiece <= 0) || (heightOfGamePiece <= 0)) { throw new System.ArgumentException("Height or Width of block cannot be less than 0."); } this.Width = widthOfThisGamePiece; this.Height = heightOfGamePiece; }
/// <summary> /// An operation that sets the position of the block. /// /// @param firstParam a description of this parameter /// </summary> /// <param name="xPos"> /// </param> /// <param name="yPos"> /// </param> /// <param name="zPos"> /// </param> /// <returns> /// </returns> public virtual void SetPosition(float xPos, float yPos, float zPos) { this.Position = new MPoint3D(xPos, yPos, zPos); }