/// <summary> /// Retrieves a Shape object based on an Enum value /// </summary> /// <param name="shapes"></param> /// <returns></returns> public Shape GetShape(GamePieceShapes shapes) { Shape shape; switch (shapes) { case GamePieceShapes.SHAPE_CIRCLE: shape = new Ellipse { Width = GetWidth, Height = GetHeight, Fill = GetColor(Piece.Owner) }; break; case GamePieceShapes.SHAPE_SQUARE: shape = new Rectangle { Width = GetWidth, Height = GetHeight, Fill = GetColor(Piece.Owner) }; break; default: shape = new Ellipse { Width = 10, Height = 10, Fill = Brushes.Gray }; break; } // Add the hover effect for the shapes using MouseEnter and MouseLeace shape.MouseEnter += new System.Windows.Input.MouseEventHandler(shape_MouseEnter); shape.MouseLeave += new System.Windows.Input.MouseEventHandler(shape_MouseLeave); return(shape); }
/// <summary> /// Default constructor /// </summary> /// <param name="owner">Enum for the owner of the game piece</param> /// <param name="shape">Enum for the shape of the game piece</param> public Gamepiece(Tokens owner, GamePieceShapes shape) { Owner = owner; PieceShape = shape; }