public InterestPoint(Bounds bounds, SpeechBubble.Side side, SpeechBubble.Side offside)
     : this(bounds, side,
            (IsVertical(side)?
             (offside == SpeechBubble.Side.Left ? 0f : 1f) :
             (offside == SpeechBubble.Side.Top ? 0f : 1f)))
 {
 }
        public InterestPoint(Bounds bounds, SpeechBubble.Side side, float positionOnSide)
        {
            this.desirability   = -1;
            this.side           = side;
            this.positionOnSide = Mathf.Clamp01(positionOnSide);


            float p = Mathf.Clamp(positionOnSide, 0.1f, 0.9f);

            this.position = CalcPoint(bounds, side, p);
        }
    private static SpeechBubble.Side Opposite(this SpeechBubble.Side side)
    {
        switch (side)
        {
        case SpeechBubble.Side.Top:
            return(SpeechBubble.Side.Bottom);

        case SpeechBubble.Side.Right:
            return(SpeechBubble.Side.Left);

        case SpeechBubble.Side.Bottom:
            return(SpeechBubble.Side.Top);

        case SpeechBubble.Side.Left:
            return(SpeechBubble.Side.Right);

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
        public static Vector3 CalcPoint(Bounds bounds, SpeechBubble.Side side, float p)
        {
            switch (side)
            {
            case SpeechBubble.Side.Left:
                return(new Vector3(bounds.min.x, bounds.min.y + bounds.size.y * p));

            case SpeechBubble.Side.Right:
                return(new Vector3(bounds.max.x, bounds.min.y + bounds.size.y * p));

            case SpeechBubble.Side.Top:
                return(new Vector3(bounds.min.x + bounds.size.x * p, bounds.max.y));

            case SpeechBubble.Side.Bottom:
                return(new Vector3(bounds.min.x + bounds.size.x * p, bounds.min.y));

            default:
                return(bounds.center);
            }
        }
 private static bool IsVertical(this SpeechBubble.Side side)
 {
     return(side == SpeechBubble.Side.Top || side == SpeechBubble.Side.Bottom);
 }
 private static bool IsHorizontal(this SpeechBubble.Side side)
 {
     return(!IsVertical(side));
 }