Beispiel #1
0
        public static void ThrowSprayTrail(Vector3 loc, Map map, Vector3 origin, Vector3 destination, string defname = null, float size = 1.5f, int rotationRate = 240, float projectieSpeed = 0, Color?color = null)
        {
            if (map == null)
            {
                return;
            }
            if (!loc.InBounds(map))
            {
                return;
            }
            if (!GenView.ShouldSpawnMotesAt(loc, map))
            {
                return;
            }
            float forward = 0f;

            if ((destination - origin).MagnitudeHorizontalSquared() > 0.001f)
            {
                forward = (destination - origin).AngleFlat();
            }
            float backward = 0f;

            if ((origin - destination).MagnitudeHorizontalSquared() > 0.001f)
            {
                backward = (origin - destination).AngleFlat();
            }
            TrailThrower.ThrowSprayTrail(loc, map, forward, backward, defname, size, rotationRate, projectieSpeed, color);
        }
        public virtual void TrailTick()
        {
            if (AMAMod.settings.AllowProjectileTrail)
            {
                if (!Trailers.NullOrEmpty())
                {
                    foreach (TrailerProjectileExtension trailer in Trailers)
                    {
                        if (ticksToImpact % trailer.trailerMoteInterval == 0 && (trailer.trailWhenLanded))
                        {
                            for (int ii = 0; ii < trailer.motesThrown; ii++)
                            {
                                //    Trail1Thrower.ThrowSmokeTrail(__instance.Position.ToVector3Shifted(), trailer.trailMoteSize, __instance.Map, trailer.trailMoteDef);

                                //    TrailThrower.ThrowSmokeTrail(__instance.DrawPos, trailer.trailMoteSize * DistanceCoveredFraction(___origin, ___destination, ___ticksToImpact, __instance.def.projectile.SpeedTilesPerTick), __instance.Map, trailer.trailMoteDef, __instance);
                                Color?DC = null;
                                if (trailer.useGraphicColor)
                                {
                                    DC = this.DrawColor;
                                }
                                else
                                if (trailer.useGraphicColorTwo)
                                {
                                    DC = this.DrawColorTwo;
                                }
                                TrailThrower.ThrowSprayTrail(this.DrawPos, this.Map, origin, destination, trailer.trailMoteDef, trailer.trailMoteSize, 240, this.def.projectile.SpeedTilesPerTick, DC);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
 // Token: 0x06000003 RID: 3 RVA: 0x000020FC File Offset: 0x000010FC
 public override void Tick()
 {
     base.Tick();
     checked
     {
         this.TicksforAppearence--;
         bool flag = this.TicksforAppearence == 0 && base.Map != null;
         if (flag)
         {
             TrailThrower.ThrowSmokeTrail(base.Position.ToVector3Shifted(), 0.7f, base.Map, "Mote_Smoke");
             this.TicksforAppearence = 6;
         }
     }
 }
        public override void Tick()
        {
            base.Tick();

            this.realPosition = new Vector2(base.ExactPosition.x, base.ExactPosition.z);
            distancetotravel  = launcher.Position.DistanceTo(usedTarget.Cell);
            distancetraveled  = launcher.Position.DistanceTo(this.Position);
            traveled          = (distancetraveled / distancetotravel);
            pos = this.Position;
            checked
            {
                this.age++;
                this.TicksforAppearence--;
                bool flag = this.TicksforAppearence == 0 && base.Map != null;
                if (flag)
                {
                    if (pos != IntVec3.Invalid)
                    {
                        TrailThrower.ThrowSprayTrail(DrawPos, Map, origin, destination, null, 1.5f * traveled, 240, def.projectile.SpeedTilesPerTick);
                        if (pos != this.Position)
                        {
                            Rand.PushState();
                            if (Rand.Chance(0.75f * traveled))
                            {
                                TrySpread();
                            }
                            Rand.PopState();
                        }
                    }
                    Rand.PushState();
                    if (Rand.Chance(0.75f * traveled))
                    {
                        if (traveled > 0.5f)
                        {
                            if (Rand.Chance(0.25f * traveled))
                            {
                                Ignite();
                            }
                        }
                    }
                    Rand.PopState();
                    this.TicksforAppearence = 6;
                }
            }
        }
Beispiel #5
0
        public static void ThrowSprayTrail(Vector3 loc, Map map, float angle, float angleR, string defname = null, float size = 1.5f, int rotationRate = 240, float projectieSpeed = 0, Color?color = null)
        {
            ThingDef def = defname.NullOrEmpty() ? null : DefDatabase <ThingDef> .GetNamedSilentFail(defname);

            MoteThrown moteThrown = TrailThrower.NewBaseAirPuff(def, size, rotationRate);

            moteThrown.exactPosition     = loc;
            moteThrown.solidTimeOverride = 0;
            moteThrown.exactPosition    += Quaternion.AngleAxis(Rand.Range(-10, 10) + angle, Vector3.up) * Vector3.back * Rand.Range(0, projectieSpeed);
            //moteThrown.exactPosition += new Vector3(Rand.Range(-0.05f, 0.05f), 0f, Rand.Range(-0.05f, 0.05f));
            moteThrown.exactRotation = Rand.Range(0, 360);
            if (color.HasValue)
            {
                moteThrown.instanceColor = color.Value;
            }
            moteThrown.SetVelocity((float)Rand.Range(-15, 15) + angle, Rand.Range(1.2f, 1.5f) + (-(projectieSpeed / 2)));
            GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
        }
Beispiel #6
0
        public static void ThrowAirPuffUp(Vector3 loc, Map map)
        {
            if (map == null)
            {
                return;
            }
            if (!loc.InBounds(map))
            {
                return;
            }
            if (!GenView.ShouldSpawnMotesAt(loc, map))
            {
                return;
            }
            MoteThrown moteThrown = TrailThrower.NewBaseAirPuff();

            moteThrown.exactPosition  = loc;
            moteThrown.exactPosition += new Vector3(Rand.Range(-0.02f, 0.02f), 0f, Rand.Range(-0.02f, 0.02f));
            moteThrown.SetVelocity((float)Rand.Range(-45, 45), Rand.Range(1.2f, 1.5f));
            GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
        }
Beispiel #7
0
        public override void Tick()
        {
            base.Tick();
            if (assignedTarget != null)
            {
                if (assignedTarget.Position != this.DestinationCell)
                {
                    //    Log.Message("Target moved");
                    this.destination = assignedTarget.Position.ToVector3Shifted();
                    //    this.ticksToImpact = UpdateTicksToImpact;
                }
            }
            if (delay > 0)
            {
                delay--;
            }
            else
            {
                this.ticksToImpact--;
                if (this.ticksToImpact == 15)
                {
                    this.HitRoof();
                }
                //    this.ticksToImpact-= (int)CurrentSpeed;
            }
            if (!this.ExactPosition.InBounds(base.Map))
            {
                this.ticksToImpact++;
                base.Position = this.ExactPosition.ToIntVec3();
                this.Destroy(DestroyMode.Vanish);
            }
            else
            {
                base.Position = this.ExactPosition.ToIntVec3();
                if (!Trailers.NullOrEmpty())
                {
                    foreach (TrailerProjectileExtension trailer in Trailers)
                    {
                        if (ticksToImpact % trailer.trailerMoteInterval == 0)
                        {
                            for (int ii = 0; ii < trailer.motesThrown; ii++)
                            {
                                //    Trail1Thrower.ThrowSmokeTrail(__instance.Position.ToVector3Shifted(), trailer.trailMoteSize, __instance.Map, trailer.trailMoteDef);

                                //    TrailThrower.ThrowSmokeTrail(__instance.DrawPos, trailer.trailMoteSize * DistanceCoveredFraction(___origin, ___destination, ___ticksToImpact, __instance.def.projectile.SpeedTilesPerTick), __instance.Map, trailer.trailMoteDef, __instance);
                                Color?DC = null;
                                if (trailer.useGraphicColor)
                                {
                                    DC = flyingThing.DrawColor;
                                }
                                else
                                if (trailer.useGraphicColorTwo)
                                {
                                    DC = flyingThing.DrawColorTwo;
                                }
                                TrailThrower.ThrowSprayTrail(this.DrawPos, this.Map, origin, destination, trailer.trailMoteDef, trailer.trailMoteSize, 240, this.def.projectile.SpeedTilesPerTick, DC);
                            }
                        }
                    }
                }
                bool flag4 = this.ticksToImpact <= 0;
                bool flag5 = flag4;
                if (flag5)
                {
                    bool flag6 = this.DestinationCell.InBounds(base.Map);
                    bool flag7 = flag6;
                    if (flag7)
                    {
                        base.Position = this.DestinationCell;
                    }
                    this.ImpactSomething();
                }
            }
        }