public static void DrawParams(DoorExpandedDef thingDef, Vector3 drawPos, Rot4 rotation, out Mesh mesh, out Matrix4x4 matrix, float mod = 1, bool flipped = false) { bool verticalRotation = rotation.IsHorizontal; Vector3 rotationVector = default(Vector3); if (!flipped) { rotationVector = new Vector3(-1f, 0f, 0f); mesh = MeshPool.plane10; } else { rotationVector = new Vector3(1f, 0f, 0f); mesh = MeshPool.plane10Flip; } Quaternion rotQuat = rotation.AsQuat; rotationVector = rotQuat * rotationVector; Vector3 graphicVector = drawPos; graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable); graphicVector += rotationVector * mod; //Vector3 scaleVector = new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y); float persMod = (thingDef.fixedPerspective) ? 2f : 1f; Vector3 scaleVector = (verticalRotation) ? new Vector3(thingDef.graphicData.drawSize.x * persMod, 1f, thingDef.graphicData.drawSize.y * persMod) : new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y); matrix = default(Matrix4x4); matrix.SetTRS(graphicVector, rotQuat, scaleVector); }
//[ReloadMethod] public void DrawStretchParams(DoorExpandedDef thingDef, Vector3 drawPos, Rot4 rotation, out Mesh mesh, out Matrix4x4 matrix, float mod = 1, bool flipped = false) { base.Rotation = Building_Door.DoorRotationAt(base.Position, base.Map); bool verticalRotation = base.Rotation.IsHorizontal; Vector3 rotationVector = default(Vector3); if (!flipped) { rotationVector = new Vector3(0f, 0f, -1f); mesh = MeshPool.plane10; } else { rotationVector = new Vector3(0f, 0f, 1f); mesh = MeshPool.plane10Flip; } rotation.Rotate(RotationDirection.Clockwise); rotationVector = rotation.AsQuat * rotationVector; Vector3 graphicVector = drawPos; graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable); graphicVector += rotationVector * (mod * 1.15f); //Vector3 scaleVector = new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y); float persMod = (thingDef.fixedPerspective) ? 2f : 1f; Vector3 scaleVector = (verticalRotation) ? new Vector3((thingDef.graphicData.drawSize.x * persMod) - mod * 1.3f, 1f, thingDef.graphicData.drawSize.y * persMod) : new Vector3((thingDef.graphicData.drawSize.x) - mod * 1.3f, 1f, thingDef.graphicData.drawSize.y); matrix = default(Matrix4x4); matrix.SetTRS(graphicVector, base.Rotation.AsQuat, scaleVector); }
public override void Draw() { base.Draw(); Vector3 vector = base.DrawPos; vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead); Vector3 s = new Vector3(matMagnitude, matMagnitude, matMagnitude); Matrix4x4 matrix = default(Matrix4x4); float angle = 0f; matrix.SetTRS(vector, Quaternion.AngleAxis(angle, Vector3.up), s); if (matRng == 0) { Graphics.DrawMesh(MeshPool.plane10, matrix, Building_TMCooler.coolerMat_1, 0); } else if (matRng == 1) { Graphics.DrawMesh(MeshPool.plane10, matrix, Building_TMCooler.coolerMat_2, 0); } else { Graphics.DrawMesh(MeshPool.plane10, matrix, Building_TMCooler.coolerMat_3, 0); } }
public static void RecalcIconPositionsPSI() { SettingsPSI psiSettings = Settings.PSISettings; // _iconPosVectors = new Vector3[18]; IconPosVectorsPSI = new Vector3[40]; for (int index = 0; index < IconPosVectorsPSI.Length; ++index) { int num1 = index / psiSettings.IconsInColumn; int num2 = index % psiSettings.IconsInColumn; if (psiSettings.IconsHorizontal) { int num3 = num1; num1 = num2; num2 = num3; } float y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays); IconPosVectorsPSI[index] = new Vector3( (float)(-0.600000023841858 * psiSettings.IconMarginX - 0.550000011920929 * psiSettings.IconSize * psiSettings.IconOffsetX * num1), y, (float)(-0.600000023841858 * psiSettings.IconMarginY + 0.550000011920929 * psiSettings.IconSize * psiSettings.IconOffsetY * num2)); } }
public static void PrintOverlayConnectorBaseFor(SectionLayer layer, Thing t) { Vector3 center = t.TrueCenter(); center.y = Altitudes.AltitudeFor(AltitudeLayer.MapDataOverlay); Printer_Plane.PrintPlane(layer, center, new Vector2(1f, 1f), WaterOverlayMats.MatConnectorBase, 0f, false, null, null, 0.01f); }
private void DrawWings(Vector3 pawnVec, Pawn flyingPawn, int magnitude) { bool flag = !pawn.Dead && !pawn.Downed; if (flag) { float num = Mathf.Lerp(1.2f, 1.55f, magnitude); Vector3 vector = pawnVec; vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead); float angle = (float)Rand.Range(0, 360); Vector3 s = new Vector3(5f, 5f, 5f); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(vector, Quaternion.AngleAxis(0f, Vector3.up), s); if (flyingPawn.Rotation == Rot4.South || flyingPawn.Rotation == Rot4.North) { Graphics.DrawMesh(MeshPool.plane10, matrix, FlyingObject_DemonFlight.wingsNS, 0); } if (flyingPawn.Rotation == Rot4.East) { Graphics.DrawMesh(MeshPool.plane10, matrix, FlyingObject_DemonFlight.wingsE, 0); } if (flyingPawn.Rotation == Rot4.West) { Graphics.DrawMesh(MeshPool.plane10, matrix, FlyingObject_DemonFlight.wingsW, 0); } } }
public static void DrawDropSpotShadow(ShipBase ship, int ticks, ShipBase_Traveling travelingShip = null) { if (ticks < 0) { ticks = 0; } Vector3 result = Gen.TrueCenter(ship); if (travelingShip != null) { result = travelingShip.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.FlyingItem); } result += DropShipUtility.drawOffsetFor(ship, ticks, true); result.y = Altitudes.AltitudeFor(AltitudeLayer.Shadows); Color white = Color.white; white.a = Mathf.InverseLerp(200f, 150f, (float)ticks); DropShipUtility.shadowPropertyBlock.SetColor(Shader.PropertyToID("Cutout"), white); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(result, ship.compShip.parent.Rotation.AsQuat, new Vector3(1f, 1f, 1f)); Graphics.DrawMesh(ship.compShip.parent.Graphic.MeshAt(ship.compShip.parent.Rotation), matrix, ship.compShip.dropShadow.MatSingle, 0, null, 0, DropShipUtility.shadowPropertyBlock); }
public static void DebugPosition(Vector3 pos, Color color) { pos.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn - 1); var material = SolidColorMaterials.SimpleSolidColorMaterial(color); DrawScaledMesh(MeshPool.plane10, material, pos + new Vector3(0.5f, 0f, 0.5f), Quaternion.identity, 1.0f, 1.0f); }
// ===================== Draw ===================== /// <summary> /// Draw the projector and a line to the targeted pawn. /// </summary> public override void Draw() { base.Draw(); projectorMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect, this.projectorRotation.ToQuat(), projectorScale); if (this.powerComp.PowerOn) { Graphics.DrawMesh(MeshPool.plane10, projectorMatrix, projectorOnTexture, 0); projectorLightEffectMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect, this.projectorRotation.ToQuat(), projectorLightEffectScale); Graphics.DrawMesh(MeshPool.plane10, projectorLightEffectMatrix, projectorLightEffectTexture, 0); } else { Graphics.DrawMesh(MeshPool.plane10, projectorMatrix, projectorOffTexture, 0); } if (Find.Selector.IsSelected(this) && (this.target != null)) { Vector3 lineOrigin = this.TrueCenter(); Vector3 lineTarget = this.target.Position.ToVector3Shifted(); lineTarget.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays); lineOrigin.y = lineTarget.y; GenDraw.DrawLineBetween(lineOrigin, lineTarget, targetLineTexture); } }
//RenderPawnAt_PostFix // Verse.PawnRenderer public static void DrawAt_PostFix(Pawn_DrawTracker __instance, Vector3 loc) { Pawn pawn = (Pawn)AccessTools.Field(typeof(Pawn_DrawTracker), "pawn").GetValue(__instance); if (pawn?.GetComp <CompTransmogrified>() is CompTransmogrified compTrans && compTrans.IsTransmogrified && pawn.Spawned) { Material matSingle; matSingle = CultsDefOf.Cults_TransmogAura.graphicData.Graphic.MatSingle; float angle = 0f; angle = pawn.Rotation.AsAngle + (compTrans.Hediff.UndulationTicks * 100); float xCap = pawn.kindDef.lifeStages[0].bodyGraphicData.drawSize.x + 0.5f; float zCap = pawn.kindDef.lifeStages[0].bodyGraphicData.drawSize.y + 0.5f; float x = pawn.kindDef.lifeStages[0].bodyGraphicData.drawSize.x; float z = pawn.kindDef.lifeStages[0].bodyGraphicData.drawSize.y; float drawX = Mathf.Clamp((x + compTrans.Hediff.UndulationTicks) * compTrans.Hediff.graphicDiv, 0.01f, xCap); float drawY = Altitudes.AltitudeFor(AltitudeLayer.Terrain); float drawZ = Mathf.Clamp((z + compTrans.Hediff.UndulationTicks) * compTrans.Hediff.graphicDiv, 0.01f, zCap); Vector3 s = new Vector3(drawX, drawY, drawZ); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(loc, Quaternion.AngleAxis(angle, Vector3.up), s); Graphics.DrawMesh(MeshPool.plane10Back, matrix, matSingle, 0); } }
private void DrawShieldFade(Pawn shieldedPawn, int magnitude) { bool flag = !shieldedPawn.Dead && !shieldedPawn.Downed; if (flag) { float num = Mathf.Lerp(1.2f, 1.55f, magnitude); Vector3 vector = shieldedPawn.Drawer.DrawPos; vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead); float angle = (float)Rand.Range(0, 360); Vector3 s = new Vector3(3f, 3f, 3f); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(vector, Quaternion.AngleAxis(0f, Vector3.up), s); if (shieldedPawn.Rotation == Rot4.South || shieldedPawn.Rotation == Rot4.North) { Graphics.DrawMesh(MeshPool.plane10, matrix, HediffComp_Shield.shieldNS, 0); } if (shieldedPawn.Rotation == Rot4.East) { Graphics.DrawMesh(MeshPool.plane10, matrix, HediffComp_Shield.shieldE, 0); } if (shieldedPawn.Rotation == Rot4.West) { Graphics.DrawMesh(MeshPool.plane10, matrix, HediffComp_Shield.shieldW, 0); } } }
public void DrawPath(Pawn pathingPawn) { if (!this.Found) { return; } float y = Altitudes.AltitudeFor(AltitudeLayer.Item); if (this.NodesLeftCount > 0) { for (int i = 0; i < this.NodesLeftCount - 1; i++) { Vector3 a = this.Peek(i).ToVector3Shifted(); a.y = y; Vector3 b = this.Peek(i + 1).ToVector3Shifted(); b.y = y; GenDraw.DrawLineBetween(a, b); } if (pathingPawn != null) { Vector3 drawPos = pathingPawn.DrawPos; drawPos.y = y; Vector3 b2 = this.Peek(0).ToVector3Shifted(); b2.y = y; if ((drawPos - b2).sqrMagnitude > 0.01f) { GenDraw.DrawLineBetween(drawPos, b2); } } } }
public override void PostDraw() { Material iconMat = null; //Si temperature du device chaude if (this.powerComp.PowerOn && !this.parent.IsBrokenDown() && this.hotLevelInt != 0) { if (this.hotLevelInt == 1) { iconMat = Tex.matHotLevel1; } else if (this.hotLevelInt == 2) { iconMat = Tex.matHotLevel2; } else if (this.hotLevelInt == 3) { iconMat = Tex.matHotLevel3; } Vector3 vector = this.parent.TrueCenter(); vector.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays) + 0.28125f; vector.x += this.parent.def.size.x / 4; vector.z -= 1; var num = (Time.realtimeSinceStartup + (397f * (float)(this.parent.thingIDNumber % 571))) * 4f; var num2 = ((float)Math.Sin((double)num) + 1f) * 0.5f; num2 = 0.3f + (num2 * 0.7f); var material = FadedMaterialPool.FadedVersionOf(iconMat, num2); Graphics.DrawMesh(MeshPool.plane05, vector, Quaternion.identity, material, 0); } }
// ===================== Draw ===================== /// <summary> /// Draw the spotlight and a line to the targeted pawn. /// </summary> public override void Draw() { this.groupIdJustChanged = false; // This is done in the draw function so we can change the group of a turret several times even when the game is paused. base.Draw(); spotlightMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect, this.spotLightRotation.ToQuat(), spotlightScale); if (this.powerComp.PowerOn) { Graphics.DrawMesh(MeshPool.plane10, spotlightMatrix, spotlightOnTexture, 0); spotlightLightEffectMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect, this.spotLightRotation.ToQuat(), spotlightLightEffectScale); Graphics.DrawMesh(MeshPool.plane10, spotlightLightEffectMatrix, spotlightLightEffectTexture, 0); } else { Graphics.DrawMesh(MeshPool.plane10, spotlightMatrix, spotlightOffTexture, 0); } if (Find.Selector.IsSelected(this) && (this.target != null)) { Vector3 lineOrigin = this.TrueCenter(); Vector3 lineTarget = this.target.Position.ToVector3Shifted(); lineTarget.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays); lineOrigin.y = lineTarget.y; GenDraw.DrawLineBetween(lineOrigin, lineTarget, targetLineTexture); } }
public override void PostPreApplyDamage(DamageInfo dinfo, out bool absorbed) { //Log.Message(string.Format("Bypassing: {0}", !Props.BypassingDamageDefs.Any(def => dinfo.Def == def))); if (dinfo.Def != null && base.parent is Pawn pawn && pawn != null && Rand.Chance(Props.InvunerableSaveChance) && !Props.BypassingDamageDefs.Any(def => dinfo.Def == def)) { absorbed = true; SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(base.parent.Position, base.parent.Map, false)); Vector3 impactAngleVect = Vector3Utility.HorizontalVectorFromAngle(dinfo.Angle); Vector3 loc = base.parent.TrueCenter() + impactAngleVect.RotatedBy(180f) * 0.5f; float num = Mathf.Min(10f, 2f + (float)dinfo.Amount / 10f); MoteMaker.MakeStaticMote(loc, base.parent.Map, ThingDefOf.Mote_ExplosionFlash, num); int num2 = (int)num; for (int i = 0; i < num2; i++) { MoteMaker.ThrowDustPuff(loc, base.parent.Map, Rand.Range(0.8f, 1.2f)); float num3 = Mathf.Lerp(1.2f, 1.55f, 2f); Vector3 vector = pawn.Drawer.DrawPos; vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead); int num4 = Find.TickManager.TicksGame - this.lastAbsorbDamageTick; if (num4 < 8) { float num5 = (float)(8 - num4) / 8f * 0.05f; vector += impactAngleVect * num5; num3 -= num5; } float angle = (float)Rand.Range(0, 360); Vector3 s = new Vector3(num3, 1f, num3); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(vector, Quaternion.AngleAxis(angle, Vector3.up), s); Graphics.DrawMesh(MeshPool.plane10, matrix, CompInvunerableSaveOGStatic.BubbleMat, 0); } this.lastAbsorbDamageTick = Find.TickManager.TicksGame; }
public override void PostDraw() { base.PostDraw(); if (this.TicksLeft > 0) { Vector3 drawPos = base.parent.DrawPos; IntVec3 size = base.parent.Map.Size; float num = (float)(((float)size.z - drawPos.z) * 1.4142135381698608); Vector3 a = Vector3Utility.FromAngleFlat((float)(this.angle - 90.0)); Vector3 a2 = drawPos + a * num * 0.5f; a2.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays); float num2 = Mathf.Min((float)((float)this.TicksPassed / 10.0), 1f); Vector3 b = a * (float)((1.0 - num2) * num); float num3 = (float)(0.97500002384185791 + Mathf.Sin((float)((float)this.TicksPassed * 0.30000001192092896)) * 0.02500000037252903); if (this.TicksLeft < this.fadeOutDuration) { num3 *= (float)this.TicksLeft / (float)this.fadeOutDuration; } Color color = this.Props.color; color.a *= num3; CompOrbitalBeam.MatPropertyBlock.SetColor(ShaderPropertyIDs.Color, color); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(a2 + a * this.BeamEndHeight * 0.5f + b, Quaternion.Euler(0f, this.angle, 0f), new Vector3(this.Props.width, 1f, num)); Graphics.DrawMesh(MeshPool.plane10, matrix, CompOrbitalBeam.BeamMat, 0, null, 0, CompOrbitalBeam.MatPropertyBlock); Vector3 pos = drawPos + b; pos.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays); Matrix4x4 matrix2 = default(Matrix4x4); matrix2.SetTRS(pos, Quaternion.Euler(0f, this.angle, 0f), new Vector3(this.Props.width, 1f, this.BeamEndHeight)); Graphics.DrawMesh(MeshPool.plane10, matrix2, CompOrbitalBeam.BeamEndMat, 0, null, 0, CompOrbitalBeam.MatPropertyBlock); } }
public override void DrawWornExtras() { // base.DrawWornExtras(); if (this.ShouldDisplay) { // base.DrawWornExtras(); float num = 0f; Vector3 vector = this.Wearer.Drawer.DrawPos; // vector.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn); Vector3 s = new Vector3(1f, 1f, 1f); if (this.Wearer.Rotation == Rot4.North) { vector.y = Altitudes.AltitudeFor(AltitudeLayer.Item); vector.x -= 0.2f; vector.z -= 0.2f; } else { if (this.Wearer.Rotation == Rot4.South) { vector.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn); vector.y += 0.033f; vector.x += 0.2f; vector.z -= 0.2f; } else { if (this.Wearer.Rotation == Rot4.East) { vector.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn); vector.z = 0.2f; num = 90f; } else { if (this.Wearer.Rotation == Rot4.West) { vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead); vector.z -= 0.2f; num = 270f; } } } } if (shieldMat == null) { shieldMat = MaterialPool.MatFrom(def.graphicData.texPath); } shieldMat.color = Stuff.stuffProps.color; Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(vector, Quaternion.AngleAxis(num, Vector3.up), s); Graphics.DrawMesh(MeshPool.plane10, matrix, shieldMat, 0); } }
// 仮 private 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 = Altitudes.AltitudeFor(altitudeLayer); 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); }
public static void MakeBaseGeometry(Section section, LayerSubMesh sm, AltitudeLayer altitudeLayer) { CellRect cellRect = new CellRect(section.botLeft.x, section.botLeft.z, 17, 17); cellRect.ClipInsideMap(section.map); float y = Altitudes.AltitudeFor(altitudeLayer); sm.verts.Capacity = cellRect.Area * 9; for (int x = cellRect.minX; x <= cellRect.maxX; x++) { for (int z = cellRect.minZ; z <= cellRect.maxZ; z++) { sm.verts.Add(new Vector3((float)x, y, (float)z)); sm.verts.Add(new Vector3((float)x, y, (float)z + 0.5f)); sm.verts.Add(new Vector3((float)x, y, (float)(z + 1))); sm.verts.Add(new Vector3((float)x + 0.5f, y, (float)(z + 1))); sm.verts.Add(new Vector3((float)(x + 1), y, (float)(z + 1))); sm.verts.Add(new Vector3((float)(x + 1), y, (float)z + 0.5f)); sm.verts.Add(new Vector3((float)(x + 1), y, (float)z)); sm.verts.Add(new Vector3((float)x + 0.5f, y, (float)z)); sm.verts.Add(new Vector3((float)x + 0.5f, y, (float)z + 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); }
/* * public void LoadGraphics() * { * try * { * GraphicRequest gr = new GraphicRequest(null, * "Things/Special/Fire", * ShaderDatabase.TransparentPostLight, * Vector2.one, * Color.white, * Color.white, null, 0, null); * FireGraphic = new GraphicRotatable(gr); * } * catch (Exception e) * { * Log.Message($"TTA: CompFire caught exception {e}."); * } * } */ public override void PostDraw() { try { if (this.parent == null) { return; } if (def == null) { return; } if (!ShouldRender(thing, def)) { return; } Vector3 offset; int y = 0; switch (thing.Rotation.AsInt) { case 0: // south offset = Props.offset_south; break; case 1: // west offset = Props.offset_west; break; case 2: // north offset = Props.offset_north; break; case 3: // east offset = Props.offset_east; break; default: throw new Exception($"TTA: CompFire found thing {thing} with invalid rotation."); } Vector3 drawPosRotated = thing.DrawPos + offset; Vector3 drawSizeRotated = new Vector3(Props.fireSize.x, 1f, Props.fireSize.y); Quaternion quaternion = Quaternion.identity; y = ((int)def.altitudeLayer) + (Props.aboveThing == true ? 1 : -1); drawPosRotated.y = Altitudes.AltitudeFor((AltitudeLayer)y); FireFlicker(drawPosRotated, drawSizeRotated, quaternion); } catch (Exception e) { Log.Message($"TTA: CompFire caught exception {e}."); } }
public override void DrawAt(Vector3 drawLoc) { base.DrawAt(drawLoc); float num = 2f + (float)this.ticksToImpact / 100f; Vector3 s = new Vector3(num, 1f, num); Matrix4x4 matrix = default(Matrix4x4); drawLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Shadows); matrix.SetTRS(this.TrueCenter(), base.Rotation.AsQuat, s); }
/// <summary> /// Draw the turret top, a laser beam when drilling and a line to the targeted rock. /// </summary> public override void Draw() { base.Draw(); this.turretTopMatrix.SetTRS(base.DrawPos + new Vector3(0f, Altitudes.AltitudeFor(AltitudeLayer.Projectile), 0f) + Altitudes.AltIncVect, this.turretTopRotation.ToQuat(), this.turretTopScale); Graphics.DrawMesh(MeshPool.plane10, this.turretTopMatrix, turretTopOnTexture, 0); if (this.powerComp.PowerOn) { Graphics.DrawMesh(MeshPool.plane10, this.laserBeamMatrix, laserBeamTexture, 0); } }
public override void Draw() { bool flag = this.flyingThing != null; if (flag && solAction != SoLAction.Sleeping && solAction != SoLAction.Limbo) { Material mat = FlyingObject_SpiritOfLight.sol_down; if (drawEnum == 1) { drawEnum = -1; mat = FlyingObject_SpiritOfLight.sol_up; } else if (drawEnum == 0) { drawEnum = 1; mat = FlyingObject_SpiritOfLight.sol_side; } else { drawEnum = 0; } Vector3 vector = this.DrawPos; vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead); Vector3 s = new Vector3(.4f, pawn.DrawPos.y, .4f); Matrix4x4 matrix = default(Matrix4x4); Quaternion q = Quaternion.AngleAxis(0f, Vector3.up); if (this.solAction == SoLAction.Attacking || this.solAction == SoLAction.Returning || this.solAction == SoLAction.ChargeAttacking || solAction == SoLAction.Goto || solAction == SoLAction.Circling) { q = (Vector3Utility.ToAngleFlat(this.DrawPos - this.destination) - 90).ToQuat(); } if (this.solAction == SoLAction.ChargeAttacking) { Matrix4x4 matrix2 = default(Matrix4x4); float bScale = Mathf.Clamp(.6f + (5f / (float)this.ticksToImpact), .6f, 2.5f); Vector3 s2 = new Vector3(bScale, pawn.DrawPos.y, bScale); matrix2.SetTRS(vector, q, s2); Graphics.DrawMesh(MeshPool.plane10, matrix2, FlyingObject_SpiritOfLight.sol_blade, 0); } if (this.solAction == SoLAction.Guarding && this.assignedTarget != null) { Vector3 barrierPos = this.assignedTarget.DrawPos; Quaternion barrierRot = Quaternion.AngleAxis(Rand.Range(0, 360), Vector3.up); Matrix4x4 matrix2 = default(Matrix4x4); float bScale = 1.4f; Vector3 s2 = new Vector3(bScale, pawn.DrawPos.y, bScale); matrix2.SetTRS(barrierPos, barrierRot, s2); Graphics.DrawMesh(MeshPool.plane10, matrix2, FlyingObject_SpiritOfLight.sol_barrier, 0); } matrix.SetTRS(vector, q, s); Graphics.DrawMesh(MeshPool.plane10, matrix, mat, 0); } base.Comps_PostDraw(); }
public override void DrawAt(Vector3 drawLoc, bool flip) { base.DrawAt(drawLoc); float num = 2f + (float)this.ticksToImpact / 100f; Vector3 s = new Vector3(num, 1f, num); Matrix4x4 matrix = default(Matrix4x4); drawLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Shadows); matrix.SetTRS(this.TrueCenter(), base.Rotation.AsQuat, s); Graphics.DrawMesh(MeshPool.plane10Back, matrix, MeteorIncoming.ShadowMat, 0); }
/// <summary> /// /// </summary> public override void DrawAt(Vector3 drawLoc) { //base.DrawAt(drawLoc); IntRot rotation = base.Rotation; Vector3 layer = new Vector3(0, Altitudes.AltitudeFor(AltitudeLayer.Waist) - drawLoc.y, 0); Vector3 handleLoc = drawLoc; handleLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Waist) + 0.01f; Vector3 wheelLoc = drawLoc; wheelLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Waist) + 0.04f; Vector3 bodyLoc = drawLoc; bodyLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Waist) + 0.03f; Vector3 mountThingLoc = drawLoc; mountThingLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn); Vector3 mountThingOffset = new Vector3(0, 0, 1).RotatedBy(this.Rotation.AsAngle); Vector3 itemLoc = drawLoc; itemLoc.y = Altitudes.AltitudeFor(AltitudeLayer.PawnState); Vector3 itemOffset = new Vector3(0.02f, 0, 0).RotatedBy(this.Rotation.AsAngle); Log.Message("Altitude For Pawn: " + Altitudes.AltitudeFor(AltitudeLayer.Waist).ToString() + handleLoc.ToString() + drawLoc.ToString()); float wheel_shake = (float)((Math.Sin(tick_time) + Math.Abs(Math.Sin(tick_time))) / 40.0); wheelLoc.z = wheelLoc.z + wheel_shake; if (!this.mountContainer.Empty) { foreach (var mountThing in this.mountContainer.Contents) { Pawn p = (Pawn)mountThing; p.ExposeData(); p.Rotation = this.Rotation; p.DrawAt(mountThingLoc + mountThingOffset); p.DrawGUIOverlay(); } } if (this.Rotation.AsInt % 2 == 0) //Vertical { wheelLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Waist) + 0.02f; } graphic_Wheel.Draw(wheelLoc, rotation, this); graphic_Body.Draw(bodyLoc, rotation, this); graphic_Handle.Draw(handleLoc, rotation, this); if (!this.inventory.container.Empty) { float i = 0f; foreach (var thing in this.inventory.container.Contents) { i += 0.01f; itemLoc.y = Altitudes.AltitudeFor(AltitudeLayer.PawnState) + i; itemOffset.x += i; thing.Graphic.Draw(itemLoc + itemOffset, rotation, this); } } }
public override void DrawAt(Vector3 drawLoc) { base.DrawAt(drawLoc); float num = 5f + (float)this.ticksToImpact / 100f; Vector3 scale = new Vector3(num, 1f, num); Matrix4x4 matrix = default(Matrix4x4); drawLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Shadows); matrix.SetTRS(this.TrueCenter(), base.Rotation.AsQuat, scale); Graphics.DrawMesh(MeshPool.plane10Back, matrix, MechanoidTerraformerIncoming.shadowTexture, 0); }
//public override void CompTick() { } //public override void CompTickRare() { } public override void PostDrawExtraSelectionOverlays() { if (Overlay != null) { var drawPos = parent.DrawPos; drawPos.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead); var s = new Vector3(2.0f, 2.0f, 2.0f); var matrix = Matrix4x4.TRS(drawPos, Quaternion.AngleAxis(0, Vector3.up), s); Graphics.DrawMesh(MeshPool.plane10, matrix, Overlay.MatSingle, 0); } }
public static MoteProlonged ThrowMagicMote(float scaleMod, Thing attachee) { var moteThrown = (MoteProlonged)ThingMaker.MakeThing(UvhashDefOf.Uvhash_MoteBloodMagicCasting, null); moteThrown.Scale = 2.5f * scaleMod; moteThrown.rotationRate = 4f; moteThrown.Attach(attachee); moteThrown.exactPosition = attachee.DrawPos; moteThrown.exactPosition.y = Altitudes.AltitudeFor(AltitudeLayer.ItemImportant); GenSpawn.Spawn(moteThrown, attachee.PositionHeld, attachee.MapHeld); return(moteThrown); }
public override void DrawAt(Vector3 drawLoc) { if (!Spawned) { base.DrawAt(drawLoc); return; } saddleLoc = drawLoc; saddleLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.01f; if (mountableComp.IsMounted) { graphic_Saddle.Draw(saddleLoc, Rotation, this); Vector3 crewLoc = drawLoc; crewLoc.y = Altitudes.AltitudeFor(AltitudeLayer.PawnUnused) + 0.1f; Vector3 crewsOffset = new Vector3(0.25f, 0.02f, -0.25f); if (Rotation == Rot4.North || Rotation == Rot4.South) { crewsOffset.x = 0f; } else { crewLoc.z += 1f; } if (storage == null) { return; } foreach (Thing thing in storage.Where(x => x is Pawn).ToList()) { Pawn pawn = (Pawn)thing; if (pawn == null) { continue; } pawn.Rotation = Rotation; pawn.DrawAt(crewLoc + crewsOffset.RotatedBy(Rotation.AsAngle)); if (pawn.stances.curStance is Stance_Warmup && Find.Selector.IsSelected(this)) { Stance_Warmup stanceWarmup = pawn.stances.curStance as Stance_Warmup; float num2 = stanceWarmup.ticksLeft >= 300 ? (stanceWarmup.ticksLeft >= 450 ? 0.5f : 0.75f) : 1f; GenDraw.DrawAimPie(stanceWarmup.stanceTracker.pawn, stanceWarmup.focusTarg, (int)(stanceWarmup.ticksLeft * (double)num2), 0.2f); } } } else { base.DrawAt(drawLoc); } }
static OverlayDrawer() { OverlayDrawer.ForbiddenMat = MaterialPool.MatFrom("Things/Special/ForbiddenOverlay", ShaderDatabase.MetaOverlay); OverlayDrawer.NeedsPowerMat = MaterialPool.MatFrom("UI/Overlays/NeedsPower", ShaderDatabase.MetaOverlay); OverlayDrawer.PowerOffMat = MaterialPool.MatFrom("UI/Overlays/PowerOff", ShaderDatabase.MetaOverlay); OverlayDrawer.QuestionMarkMat = MaterialPool.MatFrom("UI/Overlays/QuestionMark", ShaderDatabase.MetaOverlay); OverlayDrawer.BrokenDownMat = MaterialPool.MatFrom("UI/Overlays/BrokenDown", ShaderDatabase.MetaOverlay); OverlayDrawer.OutOfFuelMat = MaterialPool.MatFrom("UI/Overlays/OutOfFuel", ShaderDatabase.MetaOverlay); OverlayDrawer.WickMaterialA = MaterialPool.MatFrom("Things/Special/BurningWickA", ShaderDatabase.MetaOverlay); OverlayDrawer.WickMaterialB = MaterialPool.MatFrom("Things/Special/BurningWickB", ShaderDatabase.MetaOverlay); OverlayDrawer.SingleCellForbiddenOffset = 0.3f; OverlayDrawer.BaseAlt = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays); }