SupportedHalfbrick() приватный статический Метод

private static SupportedHalfbrick ( int x, int y ) : bool
x int
y int
Результат bool
Пример #1
0
        public static bool SupportedTilesAreFine(Vector2 portalCenter, float portalAngle)
        {
            int   num;
            int   num1;
            Point tileCoordinates = portalCenter.ToTileCoordinates();
            int   num2            = (int)Math.Round((double)(MathHelper.WrapAngle(portalAngle) / 0.7853982f));

            if (num2 == 2 || num2 == -2)
            {
                num  = (num2 == 2 ? -1 : 1);
                num1 = 0;
            }
            else if (num2 == 0 || num2 == 4)
            {
                num  = 0;
                num1 = (num2 == 0 ? 1 : -1);
            }
            else if (num2 == -3 || num2 == 3)
            {
                num  = (num2 == -3 ? 1 : -1);
                num1 = -1;
            }
            else
            {
                if (num2 != 1 && num2 != -1)
                {
                    object[] objArray = new object[] { "Broken portal! (over4s = ", num2, " , ", portalAngle, ")" };
                    Main.NewText(string.Concat(objArray), 255, 255, 255, false);
                    return(false);
                }
                num  = (num2 == -1 ? 1 : -1);
                num1 = 1;
            }
            if (num != 0 && num1 != 0)
            {
                int num3 = 3;
                if (num == -1 && num1 == 1)
                {
                    num3 = 5;
                }
                if (num == 1 && num1 == -1)
                {
                    num3 = 2;
                }
                if (num == 1 && num1 == 1)
                {
                    num3 = 4;
                }
                num3--;
                if (!PortalHelper.SupportedSlope(tileCoordinates.X, tileCoordinates.Y, num3) || !PortalHelper.SupportedSlope(tileCoordinates.X + num, tileCoordinates.Y - num1, num3))
                {
                    return(false);
                }
                return(PortalHelper.SupportedSlope(tileCoordinates.X - num, tileCoordinates.Y + num1, num3));
            }
            if (num != 0)
            {
                if (num == 1)
                {
                    tileCoordinates.X = tileCoordinates.X - 1;
                }
                if (!PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y) || !PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y - 1))
                {
                    return(false);
                }
                return(PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y + 1));
            }
            if (num1 == 0)
            {
                return(true);
            }
            if (num1 == 1)
            {
                tileCoordinates.Y = tileCoordinates.Y - 1;
            }
            if (PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y) && PortalHelper.SupportedNormal(tileCoordinates.X + 1, tileCoordinates.Y) && PortalHelper.SupportedNormal(tileCoordinates.X - 1, tileCoordinates.Y))
            {
                return(true);
            }
            if (!PortalHelper.SupportedHalfbrick(tileCoordinates.X, tileCoordinates.Y) || !PortalHelper.SupportedHalfbrick(tileCoordinates.X + 1, tileCoordinates.Y))
            {
                return(false);
            }
            return(PortalHelper.SupportedHalfbrick(tileCoordinates.X - 1, tileCoordinates.Y));
        }
Пример #2
0
        public static bool SupportedTilesAreFine(Vector2 portalCenter, float portalAngle)
        {
            Point tileCoordinates = portalCenter.ToTileCoordinates();
            int   num1            = (int)Math.Round((double)MathHelper.WrapAngle(portalAngle) / 0.785398185253143);
            int   num2;
            int   num3;

            switch (num1)
            {
            case 2:
            case -2:
                num2 = num1 == 2 ? -1 : 1;
                num3 = 0;
                break;

            case 0:
            case 4:
                num2 = 0;
                num3 = num1 == 0 ? 1 : -1;
                break;

            case -3:
            case 3:
                num2 = num1 == -3 ? 1 : -1;
                num3 = -1;
                break;

            case 1:
            case -1:
                num2 = num1 == -1 ? 1 : -1;
                num3 = 1;
                break;

            default:
                Main.NewText("Broken portal! (over4s = " + (object)num1 + " , " + (object)portalAngle + ")", byte.MaxValue, byte.MaxValue, byte.MaxValue, false);
                return(false);
            }
            if (num2 != 0 && num3 != 0)
            {
                int num4 = 3;
                if (num2 == -1 && num3 == 1)
                {
                    num4 = 5;
                }
                if (num2 == 1 && num3 == -1)
                {
                    num4 = 2;
                }
                if (num2 == 1 && num3 == 1)
                {
                    num4 = 4;
                }
                int slope = num4 - 1;
                if (PortalHelper.SupportedSlope(tileCoordinates.X, tileCoordinates.Y, slope) && PortalHelper.SupportedSlope(tileCoordinates.X + num2, tileCoordinates.Y - num3, slope))
                {
                    return(PortalHelper.SupportedSlope(tileCoordinates.X - num2, tileCoordinates.Y + num3, slope));
                }
                return(false);
            }
            if (num2 != 0)
            {
                if (num2 == 1)
                {
                    --tileCoordinates.X;
                }
                if (PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y) && PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y - 1))
                {
                    return(PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y + 1));
                }
                return(false);
            }
            if (num3 == 0)
            {
                return(true);
            }
            if (num3 == 1)
            {
                --tileCoordinates.Y;
            }
            if (PortalHelper.SupportedNormal(tileCoordinates.X, tileCoordinates.Y) && PortalHelper.SupportedNormal(tileCoordinates.X + 1, tileCoordinates.Y) && PortalHelper.SupportedNormal(tileCoordinates.X - 1, tileCoordinates.Y))
            {
                return(true);
            }
            if (PortalHelper.SupportedHalfbrick(tileCoordinates.X, tileCoordinates.Y) && PortalHelper.SupportedHalfbrick(tileCoordinates.X + 1, tileCoordinates.Y))
            {
                return(PortalHelper.SupportedHalfbrick(tileCoordinates.X - 1, tileCoordinates.Y));
            }
            return(false);
        }
Пример #3
0
        // Token: 0x06000F2E RID: 3886 RVA: 0x003F205C File Offset: 0x003F025C
        public static bool SupportedTilesAreFine(Vector2 portalCenter, float portalAngle)
        {
            Point point = portalCenter.ToTileCoordinates();
            int   num   = (int)Math.Round((double)(MathHelper.WrapAngle(portalAngle) / 0.7853982f));
            int   num2;
            int   num3;

            if (num == 2 || num == -2)
            {
                num2 = ((num == 2) ? -1 : 1);
                num3 = 0;
            }
            else if (num == 0 || num == 4)
            {
                num2 = 0;
                num3 = ((num == 0) ? 1 : -1);
            }
            else if (num == -3 || num == 3)
            {
                num2 = ((num == -3) ? 1 : -1);
                num3 = -1;
            }
            else
            {
                if (num != 1 && num != -1)
                {
                    Main.NewText(string.Concat(new object[]
                    {
                        "Broken portal! (over4s = ",
                        num,
                        " , ",
                        portalAngle,
                        ")"
                    }), 255, 255, 255, false);
                    return(false);
                }
                num2 = ((num == -1) ? 1 : -1);
                num3 = 1;
            }
            if (num2 != 0 && num3 != 0)
            {
                int num4 = 3;
                if (num2 == -1 && num3 == 1)
                {
                    num4 = 5;
                }
                if (num2 == 1 && num3 == -1)
                {
                    num4 = 2;
                }
                if (num2 == 1 && num3 == 1)
                {
                    num4 = 4;
                }
                num4--;
                return(PortalHelper.SupportedSlope(point.X, point.Y, num4) && PortalHelper.SupportedSlope(point.X + num2, point.Y - num3, num4) && PortalHelper.SupportedSlope(point.X - num2, point.Y + num3, num4));
            }
            if (num2 != 0)
            {
                if (num2 == 1)
                {
                    point.X--;
                }
                return(PortalHelper.SupportedNormal(point.X, point.Y) && PortalHelper.SupportedNormal(point.X, point.Y - 1) && PortalHelper.SupportedNormal(point.X, point.Y + 1));
            }
            if (num3 != 0)
            {
                if (num3 == 1)
                {
                    point.Y--;
                }
                return((PortalHelper.SupportedNormal(point.X, point.Y) && PortalHelper.SupportedNormal(point.X + 1, point.Y) && PortalHelper.SupportedNormal(point.X - 1, point.Y)) || (PortalHelper.SupportedHalfbrick(point.X, point.Y) && PortalHelper.SupportedHalfbrick(point.X + 1, point.Y) && PortalHelper.SupportedHalfbrick(point.X - 1, point.Y)));
            }
            return(true);
        }