Ejemplo n.º 1
0
        public override bool ContainsCirc(CircStruct circ)
        {
            RectStruct boxX = new RectStruct(Position.X - circ.Size.X / 2, Position.Y, Size.X + circ.Size.X, Size.Y);
            RectStruct boxY = new RectStruct(Position.X, Position.Y - circ.Size.Y / 2, Size.X, Size.Y + circ.Size.X);
            Vector2    circOriginPosition = new Vector2(circ.Position.X + circ.Size.X / 2, circ.Position.Y + circ.Size.Y / 2);

            if (boxX.ContainsPoint(circOriginPosition) || boxY.ContainsPoint(circOriginPosition))
            {
                return(true);
            }

            List <Vector2> vertexes = new List <Vector2>();

            vertexes.Add(new Vector2(Position.X, Position.Y));
            vertexes.Add(new Vector2(Position.X + Size.X, Position.Y));
            vertexes.Add(new Vector2(Position.X, Position.Y + Size.Y));
            vertexes.Add(new Vector2(Position.X + Size.X, Position.Y + Size.Y));

            foreach (Vector2 vertex in vertexes)
            {
                if (GameMath.GetDistance(vertex, circOriginPosition) <= circ.Size.X / 2)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public override bool ContainsCirc(CircStruct circ)
        {
            if (GameMath.GetDistance(GetOrigin(), circ.GetOrigin()) <= Size.X / 2 + circ.Size.X / 2)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        public bool ContainsFullCirc(CircStruct circ)
        {
            double biggerRadius = Size.X / 2 > circ.Size.X / 2 ? Size.X / 2 : circ.Size.X / 2;

            if (GameMath.GetDistance(GetOrigin(), circ.GetOrigin()) <= biggerRadius)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
 public abstract bool ContainsCirc(CircStruct circ);