コード例 #1
0
ファイル: FlyerIncoming.cs プロジェクト: Ogliss/AdMechArmoury
        // Token: 0x06004F05 RID: 20229 RVA: 0x001A99DC File Offset: 0x001A7BDC
        public override void Impact()
        {
            for (int i = 0; i < 6; i++)
            {
                AdeptusFleckMaker.ThrowDustPuff(base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), base.Map, 1.2f);
            }
            //    FleckMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
            GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
            if (this.def.skyfaller.CausesExplosion)
            {
                GenExplosion.DoExplosion(base.Position, base.Map, this.def.skyfaller.explosionRadius, this.def.skyfaller.explosionDamage, null, GenMath.RoundRandom((float)this.def.skyfaller.explosionDamage.defaultDamage * this.def.skyfaller.explosionDamageFactor), -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false, null, (!this.def.skyfaller.damageSpawnedThings) ? this.innerContainer.ToList <Thing>() : null);
            }
            this.SpawnThings();
            this.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
            CellRect cellRect = this.OccupiedRect();

            for (int i = 0; i < cellRect.Area * this.def.skyfaller.motesPerCell; i++)
            {
                AdeptusFleckMaker.ThrowDustPuff(cellRect.RandomVector3, base.Map, 2f);
            }
            if (this.def.skyfaller.MakesShrapnel)
            {
                SkyfallerShrapnelUtility.MakeShrapnel(base.Position, base.Map, this.shrapnelDirection, this.def.skyfaller.shrapnelDistanceFactor, this.def.skyfaller.metalShrapnelCountRange.RandomInRange, this.def.skyfaller.rubbleShrapnelCountRange.RandomInRange, true);
            }
            if (this.def.skyfaller.cameraShake > 0f && base.Map == Find.CurrentMap)
            {
                Find.CameraDriver.shaker.DoShake(this.def.skyfaller.cameraShake);
            }
            if (this.def.skyfaller.impactSound != null)
            {
                this.def.skyfaller.impactSound.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None));
            }
            this.Destroy(DestroyMode.Vanish);
        }
コード例 #2
0
 private void Initialize()
 {
     if (this.pawn != null)
     {
         Rand.PushState();
         AdeptusFleckMaker.ThrowDustPuff(this.pawn.DrawPos, this.pawn.Map, Rand.Range(1.2f, 1.8f));
         Rand.PopState();
     }
 }
コード例 #3
0
ファイル: ArcingBullet.cs プロジェクト: Ogliss/AdMechArmoury
        public override void Tick()
        {
            base.Tick();
            Vector3 exactPosition = this.ExactPosition;

            //    this.ticksToImpact = UpdateTicksToImpact;
            this.ticksToImpact--;
            if (this.ticksToImpact == 15)
            {
                this.HitRoof();
            }
            if (this.landed || base.Map == null)
            {
                return;
            }
            bool flag  = !this.ExactPosition.InBounds(base.Map);
            bool flag2 = flag;

            if (flag2)
            {
                this.ticksToImpact++;
                base.Position = this.ExactPosition.ToIntVec3();
                this.Destroy(DestroyMode.Vanish);
            }
            else
            {
                base.Position = this.ExactPosition.ToIntVec3();
                bool flag3 = Find.TickManager.TicksGame % 2 == 0;
                if (flag3)
                {
                    if (this.FlightArc != null)
                    {
                        float f = this.FlightArc.Evaluate(this.TimeInAnimation);
                        exactPosition.z += this.FlightArc.Evaluate(this.TimeInAnimation);
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        Rand.PushState();
                        AdeptusFleckMaker.ThrowDustPuff(this.DrawPos, base.Map, Rand.Range(0.3f, 0.6f));
                        Rand.PopState();
                    }
                }
                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();
                }
            }
        }
コード例 #4
0
 /*
  *      protected override void SpawnThings()
  *      {
  *
  *              if (this.Contents.spawnWipeMode == null)
  *              {
  *                      base.SpawnThings();
  *                      return;
  *              }
  *              for (int i = this.innerContainer.Count - 1; i >= 0; i--)
  *              {
  *                      GenSpawn.Spawn(this.innerContainer[i], base.Position, base.Map, this.Contents.spawnWipeMode.Value);
  *              }
  *
  *      }
  */
 // Token: 0x06007932 RID: 31026 RVA: 0x00239D78 File Offset: 0x00237F78
 public override void Impact()
 {
     for (int i = 0; i < 6; i++)
     {
         AdeptusFleckMaker.ThrowDustPuff(base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), base.Map, 1.2f);
     }
     AdeptusFleckMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
     GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
     base.Impact();
 }
コード例 #5
0
 private void Break()
 {
     SoundDefOf.EnergyShield_Broken.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));
     FleckMaker.Static(base.Wearer.TrueCenter(), base.Wearer.Map, FleckDefOf.ExplosionFlash, 12f);
     for (int i = 0; i < 6; i++)
     {
         Rand.PushState();
         AdeptusFleckMaker.ThrowDustPuff(base.Wearer.TrueCenter() + Vector3Utility.HorizontalVectorFromAngle((float)Rand.Range(0, 360)) * Rand.Range(0.3f, 0.6f), base.Wearer.Map, Rand.Range(0.8f, 1.2f));
         Rand.PopState();
     }
     this.energy       = 0f;
     this.ticksToReset = this.StartingTicksToReset;
 }
コード例 #6
0
        // Token: 0x0600005B RID: 91 RVA: 0x00003DCC File Offset: 0x00001FCC
        private void AbsorbedDamage(DamageInfo dinfo)
        {
            SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));

            float num = Mathf.Min(10f, 2f + (float)dinfo.Amount / 10f);

            FleckMaker.Static(base.Wearer.DrawPos, base.Wearer.Map, FleckDefOf.ExplosionFlash, num);
            int num2 = (int)num;

            for (int i = 0; i < num2; i++)
            {
                Rand.PushState();
                AdeptusFleckMaker.ThrowDustPuff(base.Wearer.DrawPos, base.Wearer.Map, Rand.Range(0.8f, 1.2f));
                Rand.PopState();
            }
        }
コード例 #7
0
        // edited
        public static void ThrowExplosionCell(IntVec3 cell, Map map, FleckDef fleckDef, Color color, Color?dustColor = null)
        {
            bool flag = !cell.ShouldSpawnMotesAt(map);

            if (!flag)
            {
                FleckCreationData data = AdeptusFleckMaker.GetDataStatic(cell.ToVector3Shifted(), map, fleckDef, 1f);
                data.rotation      = (float)(90 * Rand.RangeInclusive(0, 3));
                data.instanceColor = new Color?(color);
                map.flecks.CreateFleck(data);
                bool flag2 = Rand.Value < 0.7f;
                if (flag2)
                {
                    AdeptusFleckMaker.ThrowDustPuff(cell, map, 1.2f, null, dustColor);
                }
            }
        }
コード例 #8
0
        public virtual void AbsorbedDamage(DamageInfo dinfo)
        {
            SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(Pawn.Position, Pawn.Map, false));
            this.impactAngleVect = Vector3Utility.HorizontalVectorFromAngle(dinfo.Angle);
            Vector3 loc = Pawn.TrueCenter() + this.impactAngleVect.RotatedBy(180f) * 0.5f;
            float   num = Mathf.Min(10f, 2f + dinfo.Amount / 10f);

            FleckMaker.Static(loc, Pawn.Map, FleckDefOf.ExplosionFlash, num);
            int num2 = (int)num;

            for (int i = 0; i < num2; i++)
            {
                Rand.PushState();
                AdeptusFleckMaker.ThrowDustPuff(loc, Pawn.Map, Rand.Range(0.8f, 1.2f));
                Rand.PopState();
            }
            this.lastAbsorbDamageTick = Find.TickManager.TicksGame;
            this.KeepDisplaying();
        }
コード例 #9
0
        // AdeptusFleckMaker.ThrowDustPuff

        /*
         * public static void ThrowDustPuff(Vector3 loc, Map map, float scale, ThingDef def = null, Color? color = null)
         * {
         *  if (!loc.ShouldSpawnMotesAt(map))
         *  {
         *      return;
         *  }
         *  MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(def ?? AdeptusThingDefOf.OG_Mote_DustPuff, null);
         *  moteThrown.Scale = 1.9f * scale;
         *  moteThrown.rotationRate = (float)Rand.Range(-60, 60);
         *  moteThrown.exactPosition = loc;
         *  moteThrown.SetVelocity((float)Rand.Range(0, 360), Rand.Range(0.6f, 0.75f));
         *  if (color.HasValue)
         *  {
         *      moteThrown.instanceColor = color.Value;
         *      //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
         *  }
         *
         *  GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
         * }
         * public static void ThrowSmoke(Vector3 loc, float size, Map map, ThingDef def = null , Color? color = null, float? exactRotation = null)
         * {
         *  if (!GenView.ShouldSpawnMotesAt(loc, map))
         *  {
         *      return;
         *  }
         *  Rand.PushState();
         *  MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(def ?? AdeptusThingDefOf.OG_Mote_Smoke, null);
         *  moteThrown.Scale = Rand.Range(1.5f, 2.5f) * size;
         *  moteThrown.rotationRate = Rand.Range(-30f, 30f);
         *  moteThrown.exactPosition = loc;
         *  moteThrown.SetVelocity((float)Rand.Range(30, 40), Rand.Range(0.5f, 0.7f));
         *  if (color.HasValue)
         *  {
         *      moteThrown.instanceColor = color.Value;
         *      //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
         *  }
         *  if (exactRotation.HasValue)
         *  {
         *      moteThrown.exactRotation += exactRotation.Value;
         *  }
         *  Rand.PopState();
         *  GenSpawn.Spawn(moteThrown, loc.ToIntVec3(), map, WipeMode.Vanish);
         * }
         */
        public static void ThrowExplosionCell(IntVec3 cell, Map map, ThingDef moteDef, Color?color = null)
        {
            if (!cell.ShouldSpawnMotesAt(map))
            {
                return;
            }
            Mote moteThrown = (Mote)ThingMaker.MakeThing(moteDef, null);

            moteThrown.exactRotation = (float)(90 * Rand.RangeInclusive(0, 3));
            moteThrown.exactPosition = cell.ToVector3Shifted();
            if (color.HasValue)
            {
                moteThrown.instanceColor = color.Value;
                //    moteThrown.instanceColor = new Color(0.368f, 0f, 1f);
            }
            GenSpawn.Spawn(moteThrown, cell, map, WipeMode.Vanish);
            if (Rand.Value < 0.7f)
            {
                AdeptusFleckMaker.ThrowDustPuff(cell.ToVector3Shifted(), map, 1.2f, null, color);
            }
        }
コード例 #10
0
        public override void PostPreApplyDamage(DamageInfo dinfo, out bool absorbed)
        {
            //Log.Message(string.Format("Bypassing: {0}", !Props.BypassingDamageDefs.Any(def => dinfo.Def == def)));

            Rand.PushState();
            bool invSave = Rand.Chance(Props.InvunerableSaveChance);

            Rand.PopState();
            if (dinfo.Def != null && base.parent is Pawn pawn && pawn != null && invSave && !Props.BypassingDamageDefs.Any(def => dinfo.Def == def))
            {
                absorbed = true;
                SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(base.parent.Position, base.parent.Map, false));
                Vector3 impactAngleVect = Vector3Utility.HorizontalVectorFromAngle(dinfo.Angle);
                Vector3 loc             = base.parent.TrueCenter() + impactAngleVect.RotatedBy(180f) * 0.5f;
                float   num             = Mathf.Min(10f, 2f + (float)dinfo.Amount / 10f);
                FleckMaker.Static(loc, base.parent.Map, FleckDefOf.ExplosionFlash, num);
                int num2 = (int)num;
                for (int i = 0; i < num2; i++)
                {
                    Rand.PushState();
                    AdeptusFleckMaker.ThrowDustPuff(loc, base.parent.Map, Rand.Range(0.8f, 1.2f));
                    float angle = (float)Rand.Range(0, 360);
                    Rand.PopState();
                    float   num3   = Mathf.Lerp(1.2f, 1.55f, 2f);
                    Vector3 vector = pawn.Drawer.DrawPos;
                    vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead);
                    int num4 = Find.TickManager.TicksGame - this.lastAbsorbDamageTick;
                    if (num4 < 8)
                    {
                        float num5 = (float)(8 - num4) / 8f * 0.05f;
                        vector += impactAngleVect * num5;
                        num3   -= num5;
                    }
                    Vector3   s      = new Vector3(num3, 1f, num3);
                    Matrix4x4 matrix = default;
                    matrix.SetTRS(vector, Quaternion.AngleAxis(angle, Vector3.up), s);
                    Graphics.DrawMesh(MeshPool.plane10, matrix, CompInvunerableSaveOGStatic.BubbleMat, 0);
                }
                this.lastAbsorbDamageTick = Find.TickManager.TicksGame;
            }
コード例 #11
0
        // edited
        public static void ThrowDustPuff(IntVec3 cell, Map map, float scale, FleckDef def = null, Color?color = null)
        {
            Vector3 throwPosExact = cell.ToVector3() + new Vector3(Rand.Value, 0f, Rand.Value);

            AdeptusFleckMaker.ThrowDustPuff(throwPosExact, map, scale, def, color);
        }