Ejemplo n.º 1
0
        public override void ProcessInput(Event ev)
        {
            base.ProcessInput(ev);
            HarpyComp harpyComp = this.pawn.TryGetComp <HarpyComp>();

            SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null);
            Find.Targeter.BeginTargeting(this, null);
        }
Ejemplo n.º 2
0
        public virtual void QueueCastingJob(LocalTargetInfo target)
        {
            HarpyComp harpyComp = this.pawn.TryGetComp <HarpyComp>();
            bool      flag      = harpyComp != null && harpyComp.cooldownTicks > 0f;

            if (!flag)
            {
                Job job = JobMaker.MakeJob(GitThingDefOf.HarpyJob_Flyability);
                job.targetA = target;
                this.pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
            }
        }
Ejemplo n.º 3
0
        internal void CheckDrafting(Thing thing)
        {
            bool flag = thing != null && thing is Pawn;

            if (flag)
            {
                HarpyComp harpyComp = thing.TryGetComp <HarpyComp>();
                bool      flag2     = harpyComp != null && harpyComp.drafted;
                if (flag2)
                {
                    harpyComp.drafted = false;
                    (thing as Pawn).drafter.Drafted = true;
                }
            }
        }
Ejemplo n.º 4
0
        private void EjectPilot()
        {
            Thing     thingForGraphic = this.GetThingForGraphic();
            HarpyComp comp            = thingForGraphic.TryGetComp <HarpyComp>();
            bool      flag            = thingForGraphic != null;

            if (flag)
            {
                GenPlace.TryPlaceThing(thingForGraphic, base.Position, base.Map, ThingPlaceMode.Near, delegate(Thing t, int count)
                {
                    PawnUtility.RecoverFromUnwalkablePositionOrKill(t.Position, t.Map);
                    bool flag2 = t.def.Fillage == FillCategory.Full && this.def.skyfaller.CausesExplosion && this.def.skyfaller.explosionDamage.isExplosive && t.Position.InHorDistOf(this.Position, this.def.skyfaller.explosionRadius);
                    if (flag2)
                    {
                        this.Map.terrainGrid.Notify_TerrainDestroyed(t.Position);
                    }
                    this.CheckDrafting(t);
                    comp.TriggerCooldown();
                }, null, default(Rot4));
            }
        }
Ejemplo n.º 5
0
        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);
        }