//public virtual void PostDeSpawn(); //public virtual void PostDestroy(DestroyMode mode = DestroyMode.Vanish); public override void PostDraw() { float wheelShake = (float)((Math.Sin(tick_time) + Math.Abs(Math.Sin(tick_time))) / 40.0); IntRot rotation = new IntRot(0); Vector3 drawLoc = new Vector3(parent.Position.x, parent.Position.y, parent.Position.z); Vector3 compOffset = new Vector3((float)-0.2, (float)0, (float)(0.2 + wheelShake)); graphic.Draw(drawLoc + compOffset, rotation, parent); }
public override void DrawAt(Vector3 drawLoc) { base.DrawAt(drawLoc); float wheelShake = (float)((Math.Sin(tick_time) + Math.Abs(Math.Sin(tick_time))) / 40.0); IntRot rotation = new IntRot(0); Vector3 compOffset = new Vector3((float)-1.2, (float)0, (float)(1.2 + wheelShake)); Log.Message("Wheel graphic info" + graphic.GraphicPath + graphic.MatSide.name); graphic.Draw(drawLoc + compOffset, rotation, parent); }
/// <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) { 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); } }
public override void DrawAt(Vector3 drawLoc) { if (!this.Spawned) { base.DrawAt(drawLoc); return; } saddleLoc = drawLoc; saddleLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.01f; if (mountableComp.IsMounted) { graphic_Saddle.Draw(saddleLoc, this.Rotation, this); Vector3 crewLoc = drawLoc; crewLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn); Vector3 crewsOffset = new Vector3(0.25f, 0.02f, -0.25f); if (this.Rotation == Rot4.North || this.Rotation == Rot4.South) { crewsOffset.x = 0f; } foreach (Pawn pawn in this.storage.Where(x => x is Pawn).ToList()) { pawn.Rotation = this.Rotation; pawn.DrawAt(crewLoc + crewsOffset.RotatedBy(this.Rotation.AsAngle)); Stance_Warmup stance_Warmup = null; if (pawn.stances.curStance is Stance_Warmup && Find.Selector.IsSelected(this)) { stance_Warmup = pawn.stances.curStance as Stance_Warmup; float pieSizeFactor; if (stance_Warmup.ticksLeft < 300) { pieSizeFactor = 1f; } else if (stance_Warmup.ticksLeft < 450) { pieSizeFactor = 0.75f; } else { pieSizeFactor = 0.5f; } GenDraw.DrawAimPie((Thing)stance_Warmup.stanceTracker.pawn, stance_Warmup.focusTarg, (int)((double)stance_Warmup.ticksLeft * (double)pieSizeFactor), 0.2f); } } } else { base.DrawAt(drawLoc); } }
public override void DrawAt(Vector3 drawLoc) { if (!this.Spawned) { base.DrawAt(drawLoc); return; } //Body and part location handleLoc = drawLoc; handleLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Item) + 0.01f; // this right? Was AltitudeLayer.Waist wheelLoc = drawLoc; wheelLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.04f; bodyLoc = drawLoc; bodyLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.03f; //Vertical if (this.Rotation.AsInt % 2 == 0) { wheelLoc.z += 0.025f * Mathf.Sin((wheelRotation * 0.10f) % (2 * Mathf.PI)); wheelLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.02f; } base.DrawAt(bodyLoc); //Wheels //Horizen if (this.Rotation.AsInt % 2 == 1) { Vector2 drawSize = this.def.graphic.drawSize; int flip = (this.Rotation == Rot4.West) ? -1 : 1; Vector3 scale = new Vector3(1f * drawSize.x, 1f, 1f * drawSize.y); Matrix4x4 matrix = new Matrix4x4(); Vector3 offset = new Vector3(-20f / 192f * drawSize.x * flip, 0, -24f / 192f * drawSize.y); Quaternion quat = this.Rotation.AsQuat; float x = 1f * Mathf.Sin((flip * wheelRotation * 0.05f) % (2 * Mathf.PI)); float y = 1f * Mathf.Cos((flip * wheelRotation * 0.05f) % (2 * Mathf.PI)); quat.SetLookRotation(new Vector3(x, 0, y), Vector3.up); matrix.SetTRS(wheelLoc + offset, quat, scale); Graphics.DrawMesh(MeshPool.plane10, matrix, graphic_Wheel.MatAt(this.Rotation), 0); } else { graphic_Wheel.Draw(wheelLoc, this.Rotation, this); } graphic_Handle.Draw(handleLoc, this.Rotation, this); }