public override void Draw() { base.Draw(); GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest); r.center = this.DrawPos + Vector3.up * 0.1f; r.size = Building_SmallPowerPlantSolar.BarSize; r.fillPercent = this.powerComp.powerOutput / 900f; r.filledMat = Building_SmallPowerPlantSolar.BarFilledMat; r.unfilledMat = Building_SmallPowerPlantSolar.BarUnfilledMat; r.margin = 0.15f; IntRot rotation = this.Rotation; rotation.Rotate(RotationDirection.Clockwise); r.rotation = rotation; GenDraw.DrawFillableBar(r); }
public override void Draw() { //Note: It's a bit odd that I'm changing game variables in Draw // but this is the easiest way to make this always look right even if // conditions change while the game is paused. rotation = DoorRotationAt(Position); //Draw the two moving doors float pctOpen = (float)visualTicksOpen / (float)VisualOpenTicksMax; float doorOffset = VisualDoorOffsetStart + (VisualDoorOffsetEnd - VisualDoorOffsetStart) * pctOpen; for (int i = 0; i < 2; i++) { Vector3 doorPos = DrawPos; doorPos.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable); Vector3 offsetNormal = new Vector3(); if (i == 0) { offsetNormal = new Vector3(0, 0, 1); } else { offsetNormal = new Vector3(0, 0, -1); } IntRot openDir = rotation; openDir.Rotate(RotationDirection.Clockwise); offsetNormal = openDir.AsQuat * offsetNormal; doorPos += offsetNormal * doorOffset; Vector3 Scaler = new Vector3(0.5f, 0.5f, 0.5f); Matrix4x4 Matrix = new Matrix4x4(); Matrix.SetTRS(doorPos, openDir.AsQuat, Scaler); Graphics.DrawMesh(MeshPool.plane10, Matrix, def.drawMat, 0); } Comps_Draw(); }
public override void Draw() { base.Draw(); CompPowerBattery comp = base.GetComp <CompPowerBattery>(); GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest); r.center = this.DrawPos + Vector3.up * 0.1f; r.size = Building_BatteryMk2.BarSize; r.fillPercent = comp.StoredEnergy / comp.props.storedEnergyMax; r.filledMat = Building_BatteryMk2.BarFilledMat; r.unfilledMat = Building_BatteryMk2.BarUnfilledMat; r.margin = 0.15f; IntRot rotation = base.Rotation; rotation.Rotate(RotationDirection.Clockwise); r.rotation = rotation; GenDraw.DrawFillableBar(r); if (this.ticksToExplode > 0) { OverlayDrawer.DrawOverlay(this, OverlayTypes.BurningWick); } }
public override void Draw() { base.Draw(); GenDraw.FillableBarRequest req = new GenDraw.FillableBarRequest(); req.center = DrawPos + Vector3.up * 0.1f; req.size = BarSize; req.fillPercent = powerComp.powerOutput / FullSunPower; //if(req.FillPercent > 0.01f ) // req.FillPercent += Mathf.Sin((Find.TickManager.tickCount+thingIDNumber) * BarWobbleFreq) * BarWobbleAmp; req.filledMat = BarFilledMat; req.unfilledMat = BarUnfilledMat; req.margin = 0.15f; IntRot rot = rotation; rot.Rotate(RotationDirection.Clockwise); req.rotation = rot; GenDraw.DrawFillableBar(req); }