Ejemplo n.º 1
0
        /// <summary>
        /// Checks if the <see cref="Engine.Player"/> is currently looking this instance.
        /// </summary>
        /// <returns><c>True</c> if looking; <c>False</c> otherwise.</returns>
        internal bool PlayerIsLookingTo()
        {
            // Shortcut.
            Player p = Engine.Default.Player;

            switch (p.Direction)
            {
            case Direction.Top:
                return(BottomRightY.LowerEqual(p.Y) && ComputeHorizontalOverlap(p).Greater(0));

            case Direction.Bottom:
                return(Y.GreaterEqual(p.BottomRightY) && ComputeHorizontalOverlap(p).Greater(0));

            case Direction.Right:
                return(X.GreaterEqual(p.BottomRightX) && ComputeVerticalOverlap(p).Greater(0));

            case Direction.Left:
                return(BottomRightX.LowerEqual(p.X) && ComputeVerticalOverlap(p).Greater(0));

            case Direction.BottomLeft:
                return(BottomRightX.LowerEqual(p.X) && Y.GreaterEqual(p.BottomRightY));

            case Direction.BottomRight:
                return(X.GreaterEqual(p.BottomRightX) && Y.GreaterEqual(p.BottomRightY));

            case Direction.TopLeft:
                return(BottomRightX.LowerEqual(p.X) && BottomRightY.LowerEqual(p.Y));

            case Direction.TopRight:
                return(X.GreaterEqual(p.BottomRightX) && BottomRightY.LowerEqual(p.Y));
            }

            return(false);
        }
Ejemplo n.º 2
0
 public override string ToString()
 {
     return("{ALL=" + All.ToString() +
            ", AllX=" + AllX.ToString() +
            ", AllY=" + AllY.ToString() +
            ", TopLeftX=" + TopLeftX.ToString() +
            ", TopLeftY=" + TopLeftY.ToString() +
            ", TopRightX=" + TopRightX.ToString() +
            ", TopRightY=" + TopRightY.ToString() +
            ", BottomLeftX=" + BottomLeftX.ToString() +
            ", BottomLeftY=" + BottomLeftY.ToString() +
            ", BottomRightX=" + BottomRightX.ToString() +
            ", BottomRightY=" + BottomRightY.ToString() + "}");
 }