示例#1
0
        public override void DrawExtraSelectionOverlays()
        {
            float range = this.GunCompEq.PrimaryVerb.verbProps.range;

            if (range < 90.0)
            {
                GenDraw.DrawRadiusRing(base.Position, range);
            }
            float minRange = this.GunCompEq.PrimaryVerb.verbProps.minRange;

            if (minRange < 90.0 && minRange > 0.10000000149011612)
            {
                GenDraw.DrawRadiusRing(base.Position, minRange);
            }
            if (this.WarmingUp)
            {
                int degreesWide = (int)((float)this.burstWarmupTicksLeft * 0.5);
                GenDraw.DrawAimPie(this, this.CurrentTarget, degreesWide, (float)((float)base.def.size.x * 0.5));
            }
            if (base.forcedTarget.IsValid)
            {
                if (base.forcedTarget.HasThing && !base.forcedTarget.Thing.Spawned)
                {
                    return;
                }
                Vector3 b = (!base.forcedTarget.HasThing) ? base.forcedTarget.Cell.ToVector3Shifted() : base.forcedTarget.Thing.TrueCenter();
                Vector3 a = this.TrueCenter();
                b.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays);
                a.y = b.y;
                GenDraw.DrawLineBetween(a, b, Building_TurretGun.ForcedTargetLineMat);
            }
        }
示例#2
0
        public override void DrawExtraSelectionOverlays()
        {
            float range = AttackVerb.verbProps.range;

            if (range < 90f)
            {
                GenDraw.DrawRadiusRing(base.Position, range);
            }
            float num = AttackVerb.verbProps.EffectiveMinRange(allowAdjacentShot: true);

            if (num < 90f && num > 0.1f)
            {
                GenDraw.DrawRadiusRing(base.Position, num);
            }
            if (WarmingUp)
            {
                int degreesWide = (int)((float)burstWarmupTicksLeft * 0.5f);
                GenDraw.DrawAimPie(this, CurrentTarget, degreesWide, (float)def.size.x * 0.5f);
            }
            if (forcedTarget.IsValid && (!forcedTarget.HasThing || forcedTarget.Thing.Spawned))
            {
                Vector3 b = (!forcedTarget.HasThing) ? forcedTarget.Cell.ToVector3Shifted() : forcedTarget.Thing.TrueCenter();
                Vector3 a = this.TrueCenter();
                b.y = AltitudeLayer.MetaOverlays.AltitudeFor();
                a.y = b.y;
                GenDraw.DrawLineBetween(a, b, ForcedTargetLineMat);
            }
        }
            public static void Postfix(Building_TurretGun __instance)
            {
                var artilleryComp = __instance.TryGetComp <CompLongRangeArtillery>();

                if (artilleryComp != null && artilleryComp.targetedTile != TargetInfo.Invalid)
                {
                    var edgeCell = artilleryComp.FacingEdgeCell;

                    // Warmup pie
                    if (artilleryComp.CanLaunch)
                    {
                        if (artilleryComp.warmupTicksLeft > 0)
                        {
                            GenDraw.DrawAimPie(__instance, edgeCell, (int)(artilleryComp.warmupTicksLeft * 0.5f), __instance.def.size.x * 0.5f);
                        }
                    }

                    // Targeting lines
                    var a = __instance.TrueCenter();
                    var b = edgeCell.CenterVector3;
                    a.y = AltitudeLayer.MetaOverlays.AltitudeFor();
                    b.y = a.y;
                    GenDraw.DrawLineBetween(a, b, Building_TurretGun.ForcedTargetLineMat);
                }
            }
示例#4
0
        public override void DrawExtraSelectionOverlays()
        {
            float range = this.GunCompEq.PrimaryVerb.verbProps.range;

            if ((double)range < 90.0)
            {
                GenDraw.DrawRadiusRing(this.Position, range);
            }
            float minRange = this.GunCompEq.PrimaryVerb.verbProps.minRange;

            if ((double)minRange < 90.0 && (double)minRange > 0.100000001490116)
            {
                GenDraw.DrawRadiusRing(this.Position, minRange);
            }
            if (this.burstWarmupTicksLeft > 0)
            {
                GenDraw.DrawAimPie((Thing)this, this.CurrentTarget, (int)((double)this.burstWarmupTicksLeft * 0.5),
                                   (float)this.def.size.x * 0.5f);
            }
            if (!this.forcedTarget.IsValid || this.forcedTarget.HasThing && !this.forcedTarget.Thing.Spawned)
            {
                return;
            }
            Vector3 B = !this.forcedTarget.HasThing
                ? this.forcedTarget.Cell.ToVector3Shifted()
                : this.forcedTarget.Thing.TrueCenter();
            Vector3 A = this.TrueCenter();

            B.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays);
            A.y = B.y;
            GenDraw.DrawLineBetween(A, B, Building_TurretSpotlight.ForcedTargetLineMat);
        }
示例#5
0
        public override void StanceDraw()
        {
            if (!Find.Selector.IsSelected(stanceTracker.pawn) || !showPie)
            {
                return;
            }

            GenDraw.DrawAimPie(stanceTracker.pawn, focusTarg, (int)(ticksLeft * (double)pieSizeFactor), 0.2f);
        }
示例#6
0
        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);
            }
        }
示例#7
0
        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);
            }
        }
示例#8
0
        public override void DrawExtraSelectionOverlays()
        {
            float range = this.GunCompEq.PrimaryVerb.verbProps.range;

            if (range < 90f)
            {
                GenDraw.DrawRadiusRing(base.Position, range);
            }
            float minRange = this.GunCompEq.PrimaryVerb.verbProps.minRange;

            if (minRange < 90f && minRange > 0.1f)
            {
                GenDraw.DrawRadiusRing(base.Position, minRange);
            }
            if (this.burstWarmupTicksLeft > 0)
            {
                int degreesWide = (int)((float)this.burstWarmupTicksLeft * 0.5f);
                GenDraw.DrawAimPie(this, this.CurrentTarget, degreesWide, (float)this.def.size.x * 0.5f);
            }
        }
        public override void DrawExtraSelectionOverlays()
        {
            if (gun == null)
            {
                return;
            }

            float range = GunCompEq.PrimaryVerb.verbProps.range;

            if (range < 90f)
            {
                GenDraw.DrawRadiusRing(Position, range);
            }
            float minRange = GunCompEq.PrimaryVerb.verbProps.minRange;

            if (minRange < 90f && minRange > 0.1f)
            {
                GenDraw.DrawRadiusRing(Position, minRange);
            }
            if (WarmingUp)
            {
                int degreesWide = (int)((float)burstWarmupTicksLeft * 0.5f);
                GenDraw.DrawAimPie(this, CurrentTarget, degreesWide, (float)def.size.x * 0.5f);
            }
            if (forcedTarget.IsValid && (!forcedTarget.HasThing || forcedTarget.Thing.Spawned))
            {
                Vector3 b;
                if (forcedTarget.HasThing)
                {
                    b = forcedTarget.Thing.TrueCenter();
                }
                else
                {
                    b = forcedTarget.Cell.ToVector3Shifted();
                }
                Vector3 a = this.TrueCenter();
                b.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays);
                a.y = b.y;
                GenDraw.DrawLineBetween(a, b, Building_TurretGun.ForcedTargetLineMat);
            }
        }
示例#10
0
        public override void DrawExtraSelectionOverlays()           // Draw at range less than 1.42 tiles
        {
            float range = this.GunCompEq.PrimaryVerb.verbProps.range;

            if (range < 90f)
            {
                GenDraw.DrawRadiusRing(base.Position, range);
            }
            float minRange = AttackVerb.verbProps.minRange;     // Changed to minRange instead of EffectiveMinRange

            if (minRange < 90f && minRange > 0.1f)
            {
                GenDraw.DrawRadiusRing(base.Position, minRange);
            }
            if (this.WarmingUp)
            {
                int degreesWide = (int)((float)this.burstWarmupTicksLeft * 0.5f);
                GenDraw.DrawAimPie(this, this.CurrentTarget, degreesWide, def.size.x * 0.5f);
            }
            if (this.forcedTarget.IsValid && (!this.forcedTarget.HasThing || this.forcedTarget.Thing.Spawned))
            {
                Vector3 b;
                if (this.forcedTarget.HasThing)
                {
                    b = this.forcedTarget.Thing.TrueCenter();
                }
                else
                {
                    b = this.forcedTarget.Cell.ToVector3Shifted();
                }
                Vector3 a = this.TrueCenter();
                b.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays);
                a.y = b.y;
                GenDraw.DrawLineBetween(a, b, Building_TurretGun.ForcedTargetLineMat);
            }
        }
        public override void DrawExtraSelectionOverlays()
        {
            float range = this.AttackVerb.verbProps.range;

            if (range < 90f)
            {
                GenDraw.DrawRadiusRing(base.Position, range);
            }
            float num = this.AttackVerb.verbProps.EffectiveMinRange(true);

            if (num < 90f && num > 0.1f)
            {
                GenDraw.DrawRadiusRing(base.Position, num);
            }
            if (this.WarmingUp)
            {
                int degreesWide = (int)((float)this.burstWarmupTicksLeft * 0.5f);
                GenDraw.DrawAimPie(this, this.CurrentTarget, degreesWide, (float)this.def.size.x * 0.5f);
            }
            if (this.forcedTarget.IsValid && (!this.forcedTarget.HasThing || this.forcedTarget.Thing.Spawned))
            {
                Vector3 vector;
                if (this.forcedTarget.HasThing)
                {
                    vector = this.forcedTarget.Thing.TrueCenter();
                }
                else
                {
                    vector = this.forcedTarget.Cell.ToVector3Shifted();
                }
                Vector3 a = this.TrueCenter();
                vector.y = AltitudeLayer.MetaOverlays.AltitudeFor();
                a.y      = vector.y;
                GenDraw.DrawLineBetween(a, vector, Building_TurretGun.ForcedTargetLineMat);
            }
        }