public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth) { this.disabled = false; HarpyComp harpyComp = this.pawn.TryGetComp <HarpyComp>(); bool flag = harpyComp.cooldownTicks > 180f; if (flag) { this.DisableWithReason("Fly_Cooldown".Translate()); } bool flag2 = this.pawn == null; if (flag2) { this.DisableWithReason("Fly_NoPawn".Translate()); } bool flag3 = this.pawn.IsBurning(); if (flag3) { this.DisableWithReason("Fly_OnFire".Translate()); } bool dead = this.pawn.Dead; if (dead) { this.DisableWithReason("Fly_Dead".Translate()); } bool inMentalState = this.pawn.InMentalState; if (inMentalState) { this.DisableWithReason("Fly_MentalState".Translate()); } bool flag4 = this.pawn.Downed || this.pawn.stances.stunner.Stunned || !this.pawn.Awake(); if (flag4) { this.DisableWithReason("Fly_Downed".Translate()); } bool flag5 = !HarpyUtility.FlightCapabable(this.pawn); if (flag5) { this.DisableWithReason("Mech_Wings".Translate()); } GizmoResult result = base.GizmoOnGUI(topLeft, maxWidth); bool flag6 = harpyComp != null && harpyComp.cooldownTicks > 0f; if (flag6) { CompProperties_HarpyComp compProperties_HarpyComp = harpyComp.props as CompProperties_HarpyComp; float value = Mathf.InverseLerp(0f, compProperties_HarpyComp.cooldown * 60f, harpyComp.cooldownTicks); Rect rect = new Rect(topLeft.x, topLeft.y, this.GetWidth(maxWidth), 75f); Widgets.FillableBar(rect, Mathf.Clamp01(value), Command_HarpyFly.cooldownBarTex, null, false); Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.UpperCenter; Widgets.Label(rect, (harpyComp.cooldownTicks / 60f).ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Absolute)); Text.Anchor = TextAnchor.UpperLeft; } return(result); }
public static bool FlightCapabable(Pawn pawn) { bool flag = pawn.RaceProps.body.GetPartsWithDef(GitThingDefOf.MechWing).Any <BodyPartRecord>(); return(flag && HarpyUtility.FlightCapability(pawn) > 1f); }