//Explosion method
 private void ExplosionThing(IntVec3 position)
 {
     BodyPartDamageInfo value1 = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside)); //What body parts will be damaged, you can use Inside, Outside and Inherit(no ide what this means and do)
     ExplosionInfo explosionInfo = new ExplosionInfo(); //This create new explosion instance
     explosionInfo.center = position; // Center of explosion, if hitThing exist it will use hitThing position, if not then it will use bullet position
     explosionInfo.radius = UnityEngine.Random.Range(1f, 5f); // This is randome range from 1 to 5 but you can set any you want. "Exeample: explosionInfo.radius =5f" this is 5 square radius
     explosionInfo.dinfo = new DamageInfo(this.def.projectile.damageDef, this.def.projectile.damageAmountBase, this.launcher, new BodyPartDamageInfo?(value1), null);// This packs all our explosion info stuff above into dinfo so explosion class can use it(i think :D)
     explosionInfo.DoExplosion(); // This starts explosion class with our info pack to do BOOM!
 }
        protected virtual void Explode()
        {
            this.Destroy(DestroyMode.Vanish);
            BodyPartDamageInfo value         = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside));
            ExplosionInfo      explosionInfo = default(ExplosionInfo);

            explosionInfo.center = base.Position;
            explosionInfo.radius = this.def.projectile.explosionRadius;
            explosionInfo.dinfo  = new DamageInfo(this.def.projectile.damageDef, 999, this.launcher, new BodyPartDamageInfo?(value), null);
            explosionInfo.postExplosionSpawnThingDef = this.def.projectile.postExplosionSpawnThingDef;
            explosionInfo.explosionSpawnChance       = this.def.projectile.explosionSpawnChance;
            explosionInfo.explosionSound             = this.def.projectile.soundExplode;
            explosionInfo.projectile = this.def;
            explosionInfo.DoExplosion();
        }
Exemplo n.º 3
0
        protected virtual void Explode()
        {
            this.Destroy(DestroyMode.Vanish);
            BodyPartDamageInfo value         = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside));
            ExplosionInfo      explosionInfo = default(ExplosionInfo);

            explosionInfo.center = base.Position;
            explosionInfo.radius = this.def.projectile.explosionRadius;
            explosionInfo.dinfo  = new DamageInfo(DamageDefOf.Bomb, 999, this.launcher, new BodyPartDamageInfo?(value), null);
            explosionInfo.postExplosionSpawnThingDef = this.def.projectile.postExplosionSpawnThingDef;
            explosionInfo.explosionSpawnChance       = this.def.projectile.explosionSpawnChance;
            explosionInfo.explosionSound             = this.def.projectile.soundExplode;
            explosionInfo.projectile = this.def;
            explosionInfo.DoExplosion();
            ThrowBigExplode(explosionInfo.center.ToVector3Shifted() + Gen.RandomHorizontalVector(explosionInfo.radius * 0.7f), explosionInfo.radius * 0.6f);
        }