Exemplo n.º 1
0
        public override void DrawGhost(IntVec3 center, Rot4 rot, ThingDef thingDef, Color ghostCol, AltitudeLayer drawAltitude)
        {
            base.DrawGhost(center, rot, thingDef, ghostCol, drawAltitude);

            GraphicDatabase.Get <Graphic_Single>(graphicPath, ShaderTypeDefOf.EdgeDetect.Shader, new Vector2(1, 3), ghostCol)
            .DrawFromDef(GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor()) + (IntVec3.South * 2).RotatedBy(rot).ToVector3(), rot, thingDef);
        }
Exemplo n.º 2
0
        // Verse.GhostDrawer
        public static bool HeronDoorGhostHandler(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic,
                                                 Color ghostCol, AltitudeLayer drawAltitude)
        {
            if (thingDef is DoorExpandedDef def && def.fixedPerspective)
            {
                Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, thingDef, ghostCol);
                //Graphic graphic = Traverse.Create(typeof(GhostDrawer)).Method("GhostGraphicFor", new object[] { thingDef.graphic, thingDef, ghostCol }).GetValue<Graphic>();
                Vector3 loc = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

                for (int i = 0; i < 2; i++)
                {
                    bool flipped = (i != 0) ? true : false;
                    Building_DoorExpanded.DrawParams(def, loc, rot, out var mesh, out var matrix, mod: 0,
                                                     flipped: flipped);
                    Graphics.DrawMesh(mesh: mesh, matrix: matrix, material: graphic.MatAt(rot: rot, thing: null),
                                      layer: 0);
                }

                if (thingDef?.PlaceWorkers?.Count > 0)
                {
                    for (int i = 0; i < thingDef.PlaceWorkers.Count; i++)
                    {
                        thingDef.PlaceWorkers[index : i]
                        .DrawGhost(def : thingDef, center : center, rot : rot, ghostCol : ghostCol);
                    }
                }

                return(false);
            }

            return(true);
        }
        public static void MakeBaseGeometry(Section section, LayerSubMesh sm, AltitudeLayer altitudeLayer)
        {
            sm.Clear(MeshParts.Verts | MeshParts.Tris);
            CellRect cellRect = new CellRect(section.botLeft.x, section.botLeft.z, 17, 17);

            cellRect.ClipInsideMap(section.map);
            float y = altitudeLayer.AltitudeFor();

            sm.verts.Capacity = cellRect.Area * 9;
            for (int i = cellRect.minX; i <= cellRect.maxX; i++)
            {
                for (int j = cellRect.minZ; j <= cellRect.maxZ; j++)
                {
                    sm.verts.Add(new Vector3((float)i, y, (float)j));
                    sm.verts.Add(new Vector3((float)i, y, (float)j + 0.5f));
                    sm.verts.Add(new Vector3((float)i, y, (float)(j + 1)));
                    sm.verts.Add(new Vector3((float)i + 0.5f, y, (float)(j + 1)));
                    sm.verts.Add(new Vector3((float)(i + 1), y, (float)(j + 1)));
                    sm.verts.Add(new Vector3((float)(i + 1), y, (float)j + 0.5f));
                    sm.verts.Add(new Vector3((float)(i + 1), y, (float)j));
                    sm.verts.Add(new Vector3((float)i + 0.5f, y, (float)j));
                    sm.verts.Add(new Vector3((float)i + 0.5f, y, (float)j + 0.5f));
                }
            }
            int num = cellRect.Area * 8 * 3;

            sm.tris.Capacity = num;
            int num2 = 0;

            while (sm.tris.Count < num)
            {
                sm.tris.Add(num2 + 7);
                sm.tris.Add(num2);
                sm.tris.Add(num2 + 1);
                sm.tris.Add(num2 + 1);
                sm.tris.Add(num2 + 2);
                sm.tris.Add(num2 + 3);
                sm.tris.Add(num2 + 3);
                sm.tris.Add(num2 + 4);
                sm.tris.Add(num2 + 5);
                sm.tris.Add(num2 + 5);
                sm.tris.Add(num2 + 6);
                sm.tris.Add(num2 + 7);
                sm.tris.Add(num2 + 7);
                sm.tris.Add(num2 + 1);
                sm.tris.Add(num2 + 8);
                sm.tris.Add(num2 + 1);
                sm.tris.Add(num2 + 3);
                sm.tris.Add(num2 + 8);
                sm.tris.Add(num2 + 3);
                sm.tris.Add(num2 + 5);
                sm.tris.Add(num2 + 8);
                sm.tris.Add(num2 + 5);
                sm.tris.Add(num2 + 7);
                sm.tris.Add(num2 + 8);
                num2 += 9;
            }
            sm.FinalizeMesh(MeshParts.Verts | MeshParts.Tris);
        }
Exemplo n.º 4
0
        public static void DrawGhostThing_NewTmp(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude,
                                                 Thing thing = null, bool drawPlaceWorkers = true)
        {
            if (baseGraphic == null)
            {
                baseGraphic = thingDef.graphic;
            }
            Graphic graphic = baseGraphic;
            Vector3 loc     = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

            DrawShadow(graphic, loc, rot, thingDef);
        }
Exemplo n.º 5
0
 public static void DrawGhostVehicle(IntVec3 center, Rot8 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude, Thing thing = null)
 {
     if (thingDef is VehicleBuildDef def)
     {
         VehicleDef vehicleDef = def.thingToSpawn;
         if (vehicleDef.GetSortedCompProperties <CompProperties_Cannons>() is CompProperties_Cannons props)
         {
             Vector3 loc = GenThing.TrueCenter(center, rot, def.Size, drawAltitude.AltitudeFor());
             vehicleDef.DrawGhostCannonTextures(loc, rot, ghostCol);
         }
     }
 }
Exemplo n.º 6
0
        // Token: 0x06000022 RID: 34 RVA: 0x00002BAC File Offset: 0x00000DAC
        public static void DrawGhostThing(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic ghostGraphic,
                                          AltitudeLayer drawAltitude)
        {
            var vector = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

            ghostGraphic.DrawFromDef(vector, rot, thingDef);
            foreach (var compProperties in thingDef.comps)
            {
                compProperties.DrawGhost(center, rot, thingDef, ghostGraphic.Color, drawAltitude);
            }

            if (thingDef.PlaceWorkers == null)
            {
                return;
            }

            foreach (var placeWorker in thingDef.PlaceWorkers)
            {
                placeWorker.DrawGhost(thingDef, center, rot, ghostGraphic.Color);
            }
        }
Exemplo n.º 7
0
        public static void DrawGhostThing(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude)
        {
            if (baseGraphic == null)
            {
                baseGraphic = thingDef.graphic;
            }
            Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, thingDef, ghostCol);
            Vector3 loc     = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor());

            graphic.DrawFromDef(loc, rot, thingDef, 0f);
            for (int i = 0; i < thingDef.comps.Count; i++)
            {
                thingDef.comps[i].DrawGhost(center, rot, thingDef, ghostCol, drawAltitude);
            }
            if (thingDef.PlaceWorkers != null)
            {
                for (int j = 0; j < thingDef.PlaceWorkers.Count; j++)
                {
                    thingDef.PlaceWorkers[j].DrawGhost(thingDef, center, rot, ghostCol);
                }
            }
        }
Exemplo n.º 8
0
 public Vector3 ToVector3ShiftedWithAltitude(AltitudeLayer AltLayer)
 {
     return(ToVector3ShiftedWithAltitude(AltLayer.AltitudeFor()));
 }
Exemplo n.º 9
0
 public static void DrawTargetHighlightWithLayer(Vector3 c, AltitudeLayer layer)
 {
     Graphics.DrawMesh(position: new Vector3(c.x, layer.AltitudeFor(), c.z), mesh: MeshPool.plane10, rotation: Quaternion.identity, material: CurTargetingMat, layer: 0);
 }