Пример #1
0
            internal surroundingTilesPhysics Solidify()
            {
                surroundingTilesPhysics result = new surroundingTilesPhysics();

                result.topleft     = solidifyTile(topleft);
                result.top         = solidifyTile(top);
                result.topright    = solidifyTile(topright);
                result.left        = solidifyTile(left);
                result.center      = solidifyTile(center);
                result.right       = solidifyTile(right);
                result.bottomleft  = solidifyTile(bottomleft);
                result.bottom      = solidifyTile(bottom);
                result.bottomright = solidifyTile(bottomright);

                return(result);
            }
Пример #2
0
        void GetSurroundingTilePhysics(out surroundingTilesPhysics phys, int x, int y)
        {
            phys = new surroundingTilesPhysics();
            bool top    = y < 1;
            bool bottom = y >= 29;
            bool left   = x < 1;
            bool right  = x >= 31;

            phys.center = physics[x, y];

            if (!left)
            {
                phys.left = physics[x - 1, y];
                if (!top)
                {
                    phys.topleft = physics[x - 1, y - 1];
                }
                if (!bottom)
                {
                    phys.bottomleft = physics[x - 1, y + 1];
                }
            }

            if (!top)
            {
                phys.top = physics[x, y - 1];
            }
            if (!bottom)
            {
                phys.bottom = physics[x, y + 1];
            }

            if (!right)
            {
                phys.right = physics[x + 1, y];
                if (!top)
                {
                    phys.topright = physics[x + 1, y - 1];
                }
                if (!bottom)
                {
                    phys.bottomright = physics[x + 1, y + 1];
                }
            }
        }