예제 #1
0
        public void HitShield(Projectile proj)
        {
            this.lastInterceptAngle = Vector3Utility.AngleToFlat(proj.DrawPos, GenThing.TrueCenter(this.parent));
            this.lastIntercepted    = Find.TickManager.TicksGame;
            float dmg = proj.DamageAmount;

            if (proj.def.projectile.damageDef == DamageDefOf.EMP)
            {
                dmg *= zzShieldHurtRate_EMP;
                dmg += ShieldEnergyCurrent * zzShieldHurtRateExtra_EMP;
            }
            else if (proj.def.projectile.damageDef == DamageDefOf.Flame)
            {
                dmg *= zzShieldHurtRate_Flame;
            }

            dmg = Mathf.Max(0, dmg * zzShieldHurtRate);

            //判定为爆炸弹丸
            if (proj.def.projectile.explosionRadius != 0)
            {
                //受到伤害取决于弹丸威力*伤害半径^2
                dmg *= Mathf.Max(1f, proj.def.projectile.explosionRadius * proj.def.projectile.explosionRadius) * zzShieldHurtRate_AOE;

                MoteMaker.ThrowMicroSparks(this.parent.DrawPos, this.parent.Map);
                GenExplosion.DoExplosion(proj.Position, this.parent.Map, Mathf.Min(proj.def.projectile.explosionRadius * 0.66f, 3f),
                                         DefDatabase <DamageDef> .GetNamed("zz_ShieldExplosion", true),
                                         null, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false, null, null);
                //Log.Message("爆炸伤害:"+ dmg * proj.def.projectile.explosionRadius+" = "+ dmg+" * "+ proj.def.projectile.explosionRadius);
            }
            //判定为普通弹丸
            else
            {
                //还用旧的伤害效果
                //On hit effects
                MoteMaker.ThrowLightningGlow(proj.ExactPosition, this.parent.Map, 0.5f);
                //On hit sound
                ShieldManagerMapComp.HitSoundDef.PlayOneShot((SoundInfo) new TargetInfo(proj.Position, proj.Map, false));
                //Log.Message("子弹伤害:" + dmg );
            }

            if (dmg >= 0)
            {
                ShieldEnergyCurrent -= dmg;
                if (CanAddMote())
                {
                    ThrowDamageMote(dmg, parent.Map, proj.Position.ToVector3(), "-" + dmg.ToString("F0") + "/ " + ShieldEnergyCurrent.ToString("F0"));
                }
            }

            proj.Destroy();
        }
예제 #2
0
        // Token: 0x06000029 RID: 41 RVA: 0x00002DD8 File Offset: 0x00000FD8
        internal void JPRotatePilot(Pawn pilot, IntVec3 targCell, out float angle)
        {
            angle = Vector3Utility.AngleToFlat(pilot.Position.ToVector3(), targCell.ToVector3());
            float offsetAngle = angle + 90f;

            if (offsetAngle > 360f)
            {
                offsetAngle -= 360f;
            }
            Rot4 facing = Rot4.FromAngleFlat(offsetAngle);

            pilot.Rotation = facing;
        }
예제 #3
0
        internal static void RotatePawn(Pawn pawn, IntVec3 targCell, out float angle)
        {
            angle = Vector3Utility.AngleToFlat(pawn.Position.ToVector3(), targCell.ToVector3());
            float num  = angle + 90f;
            bool  flag = num > 360f;

            if (flag)
            {
                num -= 360f;
            }
            Rot4 rotation = Rot4.FromAngleFlat(num);

            pawn.Rotation = rotation;
        }