Пример #1
0
        public bool CheckAndResolveStaticTileStaticTileCollision(Tile obj1, Tile obj2, double px, double py, double dx, double dy,
                                                        out Vector obj1PosDp, out Vector obj1CollDirection,
                                                        out Vector obj2PosDp, out Vector obj2CollDirection)
        {
            Circle circle = (Circle)obj1;
            Rectangle rec = (Rectangle)obj2;

            double gridVert = 0;
            double gridHorz = 0;

            if (dx < (obj2.XW * -1))
            {
                gridHorz = -1; //circle1 is on left side of circle2
            }
            else if (obj2.XW < dx)
            {
                gridHorz = 1; //circle1 is on right side of circle2
            }

            if (dy < (obj2.YW * -1))
            {
                gridVert = -1; //circle1 is on top side of circle2
            }
            else if (obj2.YW < dy)
            {
                gridVert = 1; //circle1 is on bottom side of circle2
            }

            return CollisionDetection.ProjCircleRec(circle, rec, px, py, gridHorz, gridVert,
                  out obj1PosDp, out obj1CollDirection, out obj2PosDp, out obj2CollDirection);
        }
Пример #2
0
        private _2D.Speed _speed = new _2D.Speed(new _2D.Vector(0,0), new TimeSpan(1)); //distance over time

        #endregion Fields

        #region Constructors

        public Collidable2DBase(Tile[] objects)
        {
            _objects = new List<Tile>(objects);
        }