Example #1
0
File: Room.cs Project: Milun/VWA
        public Vector2 CheckCol(Vector2 pos, Vector2 size)
        {
            ColSquare a = new ColSquare(pos, Vector2.One * -size / 2f, Vector2.One * size);

            a.DrawDebug(Editor.colorDebug3);

            foreach (Col e in cols)
            {
                Vector2 output = a.CheckCol(e);

                if (output != Vector2.Zero)
                {
                    return(output);
                }
            }


            foreach (KeyValuePair <IntVector2D, Actor> e in actors)
            {
                Vector2 output = e.Value.CheckCol(a);

                if (output != Vector2.Zero)
                {
                    return(-output);
                }
            }

            return(Vector2.Zero);
        }
Example #2
0
        public override Vector2 CheckColSquare(ColSquare other)
        {
            if (!CheckColBounds(other))
            {
                return(Vector2.Zero);
            }

            float left  = Math.Abs(other.TL.X - BR.X);
            float right = Math.Abs(other.BR.X - TL.X);
            float down  = Math.Abs(other.TL.Y - BR.Y);
            float up    = Math.Abs(other.BR.Y - TL.Y);

            if (left <= right && left <= up && left <= down)
            {
                return(new Vector2(-left, 0.0f));
            }
            if (right <= left && right <= up && right <= down)
            {
                return(new Vector2(right, 0.0f));
            }
            if (up <= right && up <= left && up <= down)
            {
                return(new Vector2(0.0f, up));
            }
            if (down <= right && down <= left && down <= up)
            {
                return(new Vector2(0.0f, -down));
            }

            return(Vector2.Zero);
        }
Example #3
0
File: Room.cs Project: Milun/VWA
        public void MsgCol(Vector2 pos, Vector2 size, string msg)
        {
            Col a = new ColSquare(pos, Vector2.Zero, Vector2.One * size);

            a.DrawDebug(Color.Pink);

            foreach (KeyValuePair <IntVector2D, Actor> e in actors)
            {
                if (e.Value.CheckTrig(a) != Vector2.Zero)
                {
                    e.Value.PassMsg(msg);
                }
                else if (e.Value.CheckCol(a) != Vector2.Zero)
                {
                    e.Value.PassMsg(msg);
                }
            }
        }
Example #4
0
 public override Vector2 CheckColSquare(ColSquare other)
 {
     return(other.CheckColCircle(this));
 }
Example #5
0
 public virtual Vector2 CheckColSquare(ColSquare other)
 {
     return(Vector2.Zero);
 }