public override void Print(SectionLayer layer, Thing thing)
        {
            Vector3 a = thing.TrueCenter();

            Rand.PushState();
            Rand.Seed = thing.Position.GetHashCode();
            Filth filth = thing as Filth;
            int   num   = (filth != null) ? filth.thickness : 3;

            for (int i = 0; i < num; i++)
            {
                Material matSingle = this.MatSingle;
                Vector3  center    = a + new Vector3(Rand.Range(-0.45f, 0.45f), 0f, Rand.Range(-0.45f, 0.45f));
                Vector2  size      = new Vector2(Rand.Range(0.8f, 1.2f), Rand.Range(0.8f, 1.2f));
                float    rot       = (float)Rand.RangeInclusive(0, 360);
                bool     flipUv    = Rand.Value < 0.5;
                Printer_Plane.PrintPlane(layer, center, size, matSingle, rot, flipUv, null, null, 0.01f);
            }
            Rand.PopState();
        }
Ejemplo n.º 2
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            base.Print(layer, thing);
            IntVec3 position = thing.Position;

            for (int i = 0; i < 4; i++)
            {
                IntVec3 c = thing.Position + GenAdj.DiagonalDirectionsAround[i];
                if (!ShouldLinkWith(c, thing) || (i == 0 && (!ShouldLinkWith(position + IntVec3.West, thing) || !ShouldLinkWith(position + IntVec3.South, thing))) || (i == 1 && (!ShouldLinkWith(position + IntVec3.West, thing) || !ShouldLinkWith(position + IntVec3.North, thing))) || (i == 2 && (!ShouldLinkWith(position + IntVec3.East, thing) || !ShouldLinkWith(position + IntVec3.North, thing))) || (i == 3 && (!ShouldLinkWith(position + IntVec3.East, thing) || !ShouldLinkWith(position + IntVec3.South, thing))))
                {
                    continue;
                }
                Vector3 center = thing.DrawPos + GenAdj.DiagonalDirectionsAround[i].ToVector3().normalized *CoverOffsetDist + Altitudes.AltIncVect + new Vector3(0f, 0f, 0.09f);
                Vector2 size   = new Vector2(0.5f, 0.5f);
                if (!c.InBounds(thing.Map))
                {
                    if (c.x == -1)
                    {
                        center.x -= 1f;
                        size.x   *= 5f;
                    }
                    if (c.z == -1)
                    {
                        center.z -= 1f;
                        size.y   *= 5f;
                    }
                    if (c.x == thing.Map.Size.x)
                    {
                        center.x += 1f;
                        size.x   *= 5f;
                    }
                    if (c.z == thing.Map.Size.z)
                    {
                        center.z += 1f;
                        size.y   *= 5f;
                    }
                }
                Printer_Plane.PrintPlane(layer, center, size, LinkedDrawMatFrom(thing, thing.Position), 0f, flipUv: false, CornerFillUVs);
            }
        }
Ejemplo n.º 3
0
        public virtual void Print(SectionLayer layer, Thing thing)
        {
            Vector2 size;
            bool    flag;

            if (this.ShouldDrawRotated)
            {
                size = this.drawSize;
                flag = false;
            }
            else
            {
                if (!thing.Rotation.IsHorizontal)
                {
                    size = this.drawSize;
                }
                else
                {
                    size = this.drawSize.Rotated();
                }
                flag = (thing.Rotation == Rot4.West && this.WestFlipped);
            }
            float num = 0f;

            if (this.ShouldDrawRotated)
            {
                num = thing.Rotation.AsAngle;
            }
            if (flag && this.data != null)
            {
                num += this.data.flipExtraRotation;
            }
            Printer_Plane.PrintPlane(layer, thing.TrueCenter(), size, this.MatAt(thing.Rotation, thing), num, flag, null, null, 0.01f, 0f);
            if (this.ShadowGraphic != null && thing != null)
            {
                this.ShadowGraphic.Print(layer, thing);
            }
        }
Ejemplo n.º 4
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            Material mat = this.LinkedDrawMatFrom(thing, thing.Position);

            Printer_Plane.PrintPlane(layer, thing.TrueCenter(), new Vector2(1f, 1f), mat, 0f, false, null, null, 0.01f, 0f);
        }
        public override void Print(SectionLayer layer, Thing thing)
        {
            base.Print(layer, thing);
            IntVec3 position = thing.Position;
            int     i        = 0;

            while (i < 4)
            {
                IntVec3 c = thing.Position + GenAdj.DiagonalDirectionsAround[i];
                if (this.ShouldLinkWith(c, thing))
                {
                    if (i == 0)
                    {
                        if (!this.ShouldLinkWith(position + IntVec3.West, thing) || !this.ShouldLinkWith(position + IntVec3.South, thing))
                        {
                            goto IL_2E7;
                        }
                    }
                    if (i == 1)
                    {
                        if (!this.ShouldLinkWith(position + IntVec3.West, thing) || !this.ShouldLinkWith(position + IntVec3.North, thing))
                        {
                            goto IL_2E7;
                        }
                    }
                    if (i == 2)
                    {
                        if (!this.ShouldLinkWith(position + IntVec3.East, thing) || !this.ShouldLinkWith(position + IntVec3.North, thing))
                        {
                            goto IL_2E7;
                        }
                    }
                    if (i == 3)
                    {
                        if (!this.ShouldLinkWith(position + IntVec3.East, thing) || !this.ShouldLinkWith(position + IntVec3.South, thing))
                        {
                            goto IL_2E7;
                        }
                    }
                    Vector3 vector  = thing.DrawPos + GenAdj.DiagonalDirectionsAround[i].ToVector3().normalized *Graphic_LinkedCornerFiller.CoverOffsetDist + Altitudes.AltIncVect + new Vector3(0f, 0f, 0.09f);
                    Vector2 vector2 = new Vector2(0.5f, 0.5f);
                    if (!c.InBounds(thing.Map))
                    {
                        if (c.x == -1)
                        {
                            vector.x  -= 1f;
                            vector2.x *= 5f;
                        }
                        if (c.z == -1)
                        {
                            vector.z  -= 1f;
                            vector2.y *= 5f;
                        }
                        if (c.x == thing.Map.Size.x)
                        {
                            vector.x  += 1f;
                            vector2.x *= 5f;
                        }
                        if (c.z == thing.Map.Size.z)
                        {
                            vector.z  += 1f;
                            vector2.y *= 5f;
                        }
                    }
                    Vector3   center        = vector;
                    Vector2   size          = vector2;
                    Material  mat           = base.LinkedDrawMatFrom(thing, thing.Position);
                    float     rot           = 0f;
                    Vector2[] cornerFillUVs = Graphic_LinkedCornerFiller.CornerFillUVs;
                    Printer_Plane.PrintPlane(layer, center, size, mat, rot, false, cornerFillUVs, null, 0.01f, 0f);
                }
IL_2E7:
                i++;
                continue;
                goto IL_2E7;
            }
        }
Ejemplo n.º 6
0
 public void PrintOnto(SectionLayer layer)
 {
     Printer_Plane.PrintPlane(layer, this.loc, Vector2.one * this.size, this.def.mat, this.rotation, false, null, null, 0.01f, 0f);
 }
Ejemplo n.º 7
0
        private void DrawFullThingCorners(Building b)
        {
            if (b.def.graphicData != null)
            {
                DamageGraphicData damageData = b.def.graphicData.damageData;
                if (damageData != null)
                {
                    Rect  damageRect             = BuildingsDamageSectionLayerUtility.GetDamageRect(b);
                    float damageTexturesAltitude = GetDamageTexturesAltitude(b);
                    float num = Mathf.Min(Mathf.Min(damageRect.width, damageRect.height), 1.5f);
                    BuildingsDamageSectionLayerUtility.GetCornerMats(out Material topLeft, out Material topRight, out Material botRight, out Material botLeft, b);
                    float num2 = num * Rand.Range(0.9f, 1f);
                    float num3 = num * Rand.Range(0.9f, 1f);
                    float num4 = num * Rand.Range(0.9f, 1f);
                    float num5 = num * Rand.Range(0.9f, 1f);
                    List <DamageOverlay> overlays = BuildingsDamageSectionLayerUtility.GetOverlays(b);
                    for (int i = 0; i < overlays.Count; i++)
                    {
                        switch (overlays[i])
                        {
                        case DamageOverlay.TopLeftCorner:
                        {
                            Rect    rect4   = new Rect(damageRect.xMin, damageRect.yMax - num2, num2, num2);
                            Vector2 center7 = rect4.center;
                            float   x4      = center7.x;
                            float   y4      = damageTexturesAltitude;
                            Vector2 center8 = rect4.center;
                            Printer_Plane.PrintPlane(this, new Vector3(x4, y4, center8.y), rect4.size, topLeft, 0f, flipUv: false, null, null, 0f);
                            break;
                        }

                        case DamageOverlay.TopRightCorner:
                        {
                            Rect    rect3   = new Rect(damageRect.xMax - num3, damageRect.yMax - num3, num3, num3);
                            Vector2 center5 = rect3.center;
                            float   x3      = center5.x;
                            float   y3      = damageTexturesAltitude;
                            Vector2 center6 = rect3.center;
                            Printer_Plane.PrintPlane(this, new Vector3(x3, y3, center6.y), rect3.size, topRight, 90f, flipUv: false, null, null, 0f);
                            break;
                        }

                        case DamageOverlay.BotRightCorner:
                        {
                            Rect    rect2   = new Rect(damageRect.xMax - num4, damageRect.yMin, num4, num4);
                            Vector2 center3 = rect2.center;
                            float   x2      = center3.x;
                            float   y2      = damageTexturesAltitude;
                            Vector2 center4 = rect2.center;
                            Printer_Plane.PrintPlane(this, new Vector3(x2, y2, center4.y), rect2.size, botRight, 180f, flipUv: false, null, null, 0f);
                            break;
                        }

                        case DamageOverlay.BotLeftCorner:
                        {
                            Rect    rect    = new Rect(damageRect.xMin, damageRect.yMin, num5, num5);
                            Vector2 center  = rect.center;
                            float   x       = center.x;
                            float   y       = damageTexturesAltitude;
                            Vector2 center2 = rect.center;
                            Printer_Plane.PrintPlane(this, new Vector3(x, y, center2.y), rect.size, botLeft, 270f, flipUv: false, null, null, 0f);
                            break;
                        }
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public void PrintOnto(SectionLayer layer)
 {
     Printer_Plane.PrintPlane(layer, loc, Vector2.one * size, def.mat, rotation);
 }