示例#1
0
        public void Execute()
        {
            if (Entity == null || Entity.MarkedForClose)
            {
                return;
            }
            var floater   = (IMyFloatingObject)Entity;
            var entVel    = Entity.Physics.LinearVelocity;
            var movingVel = entVel != Vector3.Zero ? entVel : -Shield.MyGrid.Physics.LinearVelocity;

            var rayDir    = Vector3D.Normalize(movingVel);
            var ray       = new RayD(Entity.PositionComp.WorldVolume.Center, rayDir);
            var intersect = CustomCollision.IntersectEllipsoid(Shield.DetectMatrixOutsideInv, Shield.DetectionMatrix, ray);
            var hitDist   = intersect ?? 0;
            var hitPos    = ray.Position + (ray.Direction * -hitDist);

            if (Session.Instance.MpActive)
            {
                Shield.AddShieldHit(Entity.EntityId, 1, Session.Instance.MPKinetic, null, false, hitPos);
                floater.DoDamage(9999999, Session.Instance.MpIgnoreDamage, true, null, Shield.MyCube.EntityId);
            }
            else
            {
                Shield.WorldImpactPosition = hitPos;
                Shield.ImpactSize          = 10;
                floater.DoDamage(9999999, Session.Instance.MpIgnoreDamage, false, null, Shield.MyCube.EntityId);
            }
            Shield.WebDamage = true;
            Shield.Absorb   += 1;
        }
示例#2
0
        public void Execute()
        {
            if (Entity == null || !Entity.InScene || Entity.MarkedForClose)
            {
                return;
            }
            var computedDamage = UtilsStatic.ComputeAmmoDamage(Entity);

            var damage = computedDamage * Shield.DsState.State.ModulateKinetic;

            if (computedDamage < 0)
            {
                damage = computedDamage;
            }

            var rayDir    = Vector3D.Normalize(Entity.Physics.LinearVelocity);
            var ray       = new RayD(Entity.PositionComp.WorldVolume.Center, rayDir);
            var intersect = CustomCollision.IntersectEllipsoid(ref Shield.DetectMatrixOutsideInv, Shield.DetectionMatrix, ref ray);
            var hitDist   = intersect ?? 0;
            var hitPos    = ray.Position + (ray.Direction * -hitDist);

            if (Session.Instance.MpActive)
            {
                Shield.AddShieldHit(Entity.EntityId, damage, Session.Instance.MPExplosion, null, true, hitPos);
                Entity.Close();
                Entity.InScene = false;
            }
            else
            {
                Shield.EnergyHit           = DefenseShields.HitType.Energy;
                Shield.WorldImpactPosition = hitPos;
                Shield.ImpactSize          = damage;
                UtilsStatic.CreateFakeSmallExplosion(hitPos);
                Entity.Close();
                Entity.InScene = false;
            }
            Shield.WebDamage     = true;
            Shield.Absorb       += damage;
            Shield.EnergyDamage += damage;

            Session.Instance.MissilePool.Return(this);
        }