Пример #1
0
        public void UpdateLocation()
        {
            int halfScreenWidth  = (_graphics.PreferredBackBufferWidth / 2);
            int halfScreenHeight = (_graphics.PreferredBackBufferHeight / 2);

            if (Position.Y > halfScreenHeight)
            {
                VerticalLocation = VerticalLocation.Bottom;
            }
            else
            {
                VerticalLocation = VerticalLocation.Top;
            }
        }
Пример #2
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            if (obj is ChessBoardLocation otherLocation)
            {
                int compare = HorizontalLocation.CompareTo(otherLocation.HorizontalLocation);
                if (compare == 0)
                {
                    return(VerticalLocation.CompareTo(otherLocation.VerticalLocation));
                }

                return(compare);
            }
            else
            {
                throw new ArgumentException("Object is not a ChessBoardLocation");
            }
        }