예제 #1
0
        public void Print(Graphic_LinkedCornerFiller graphic, SectionLayer layer, Thing thing, int curLevel, int baseLevel)
        {
            BasePrint(graphic, layer, thing);
            IntVec3 position = thing.Position;

            for (int i = 0; i < 4; i++)
            {
                IntVec3 c = thing.Position + GenAdj.DiagonalDirectionsAround[i];
                if (!graphic.ShouldLinkWith(c, thing) || (i == 0 && (!graphic.ShouldLinkWith(position + IntVec3.West, thing) || !graphic.ShouldLinkWith(position + IntVec3.South, thing))) ||
                    (i == 1 && (!graphic.ShouldLinkWith(position + IntVec3.West, thing) || !graphic.ShouldLinkWith(position + IntVec3.North, thing))) || (i == 2 &&
                                                                                                                                                          (!graphic.ShouldLinkWith(position + IntVec3.East, thing) || !graphic.ShouldLinkWith(position + IntVec3.North, thing))) || (i == 3 &&
                                                                                                                                                                                                                                                                                     (!graphic.ShouldLinkWith(position + IntVec3.East, thing) || !graphic.ShouldLinkWith(position + IntVec3.South, thing))))
                {
                    continue;
                }
                DrawPos_Patch.ChangeDrawPos    = false;
                TrueCenter_Patch.ChangeDrawPos = false;
                Vector3 center = thing.DrawPos + GenAdj.DiagonalDirectionsAround[i].ToVector3().normalized *Graphic_LinkedCornerFiller.CoverOffsetDist + Altitudes.AltIncVect
                                 + new Vector3(0f, 0f, 0.09f);
                center.z -= (curLevel - baseLevel) / 2f;
                center.y -= (curLevel - baseLevel) / 2f;
                DrawPos_Patch.ChangeDrawPos    = true;
                TrueCenter_Patch.ChangeDrawPos = true;
                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(graphic, thing, thing.Position), 0f, flipUv: false, Graphic_LinkedCornerFiller.CornerFillUVs);
            }
        }
예제 #2
0
        public Material LinkedDrawMatFrom(Graphic_LinkedCornerFiller graphic, Thing parent, IntVec3 cell)
        {
            int num  = 0;
            int num2 = 1;

            for (int i = 0; i < 4; i++)
            {
                IntVec3 c = cell + GenAdj.CardinalDirections[i];
                if (graphic.ShouldLinkWith(c, parent))
                {
                    num += num2;
                }
                num2 *= 2;
            }
            LinkDirections linkSet = (LinkDirections)num;

            return(MaterialAtlasPool.SubMaterialFromAtlas(graphic.subGraphic.MatSingleFor(parent), linkSet));
        }
예제 #3
0
        public void BasePrint(Graphic_LinkedCornerFiller graphic, SectionLayer layer, Thing thing)
        {
            Material mat = LinkedDrawMatFrom(graphic, thing, thing.Position);

            Printer_Plane.PrintPlane(layer, thing.TrueCenter(), new Vector2(1f, 1f), mat);
        }