Ejemplo n.º 1
0
 public override bool Hit(Bullet bullet, Vec2 hitPos)
 {
     if (BulletThroughNotEquipped && (_equippedDuck == null || bullet.owner == duck || !bullet.isLocal))
     {
         return(false);
     }
     if (_isArmor)
     {
         if (bullet.isLocal && duck != null)
         {
             if (--EquipmentHitPoints <= 0 && KnockOffOnHit)
             {
                 duck.KnockOffEquipment(this, ting: true, bullet);
                 Fondle(this, DuckNetwork.localConnection);
             }
         }
         if (bullet.isLocal && Network.isActive)
         {
             NetSoundEffect.Play("equipmentTing");
         }
         bullet.hitArmor = true;
         Level.Add(MetalRebound.New(hitPos.x, hitPos.y, (bullet.travelDirNormalized.x > 0f) ? 1 : (-1)));
         for (int i = 0; i < 6; i++)
         {
             Level.Add(Spark.New(x, y, bullet.travelDirNormalized));
         }
         return(thickness > bullet.ammo.penetration);
     }
     return(base.Hit(bullet, hitPos));
 }
Ejemplo n.º 2
0
        public override bool Hit(Bullet bullet, Vec2 hitPos)
        {
            if (_equippedDuck == null || bullet.owner == duck || !bullet.isLocal)
            {
                return(false);
            }
            if (_isArmor && duck != null)
            {
                EquipmentHitPoints--;
                if (bullet.isLocal && EquipmentHitPoints <= 0)
                {
                    duck.KnockOffEquipment(this, ting: true, bullet);
                    Fondle(this, DuckNetwork.localConnection);
                }
                if (MakeDefaultHitEffects)
                {
                    if (bullet.isLocal && Network.isActive)
                    {
                        NetSoundEffect.Play("equipmentTing");
                    }
                    bullet.hitArmor = true;
                    Level.Add(MetalRebound.New(hitPos.x, hitPos.y, (bullet.travelDirNormalized.x > 0f) ? 1 : (-1)));
                    for (int i = 0; i < 6; i++)
                    {
                        Level.Add(Spark.New(x, y, bullet.travelDirNormalized));
                    }
                }
                return(BaseBaseHit());
            }
            return(BaseBaseHit());

            bool BaseBaseHit()
            {
                if (MakeDefaultHitEffects)
                {
                    if (physicsMaterial == PhysicsMaterial.Metal)
                    {
                        Level.Add(MetalRebound.New(hitPos.x, hitPos.y, (bullet.travelDirNormalized.x > 0f) ? 1 : (-1)));
                        hitPos -= bullet.travelDirNormalized;
                        for (int j = 0; j < 3; j++)
                        {
                            Level.Add(Spark.New(hitPos.x, hitPos.y, bullet.travelDirNormalized));
                        }
                    }
                    else if (physicsMaterial == PhysicsMaterial.Wood)
                    {
                        hitPos -= bullet.travelDirNormalized;
                        for (int i = 0; i < 3; i++)
                        {
                            WoodDebris woodDebris = WoodDebris.New(hitPos.x, hitPos.y);
                            woodDebris.hSpeed = 0f - bullet.travelDirNormalized.x + Rando.Float(-1f, 1f);
                            woodDebris.vSpeed = 0f - bullet.travelDirNormalized.y + Rando.Float(-1f, 1f);
                            Level.Add(woodDebris);
                        }
                    }
                }
                return(thickness > bullet.ammo.penetration);
            }
        }
Ejemplo n.º 3
0
 public override bool Hit(Bullet bullet, Vec2 hitPos)
 {
     Level.Add(MetalRebound.New(hitPos.x, hitPos.y, (double)bullet.travelDirNormalized.x > 0.0 ? 1 : -1));
     //SFX.Play(Mod.GetPath<EdoMod>("SFX\\anvilTing"));
     hitPos -= bullet.travelDirNormalized;
     for (int index = 0; index < 3; ++index)
     {
         Level.Add(Spark.New(hitPos.x, hitPos.y, bullet.travelDirNormalized, 0.02f));
     }
     return(thickness > bullet.ammo.penetration);
 }
Ejemplo n.º 4
0
        public override bool Hit(Bullet bullet, Vec2 hitPos)
        {
            Level.Add(MetalRebound.New(hitPos.x, hitPos.y, (bullet.travelDirNormalized.x > 0f) ? 1 : -1));
            hitPos -= bullet.travelDirNormalized;
            for (int i = 0; i < 3; i++)
            {
                Level.Add(Spark.New(hitPos.x, hitPos.y, bullet.travelDirNormalized));
            }

            SFX.Play("ting");
            return(thickness > bullet.ammo.penetration);
        }
Ejemplo n.º 5
0
        public static MetalRebound New(float xpos, float ypos, int offDir)
        {
            MetalRebound metalRebound;

            if (MetalRebound._objects[MetalRebound._lastActiveObject] == null)
            {
                metalRebound = new MetalRebound();
                MetalRebound._objects[MetalRebound._lastActiveObject] = metalRebound;
            }
            else
            {
                metalRebound = MetalRebound._objects[MetalRebound._lastActiveObject];
            }
            MetalRebound._lastActiveObject = (MetalRebound._lastActiveObject + 1) % MetalRebound.kMaxObjects;
            metalRebound.Init(xpos, ypos, offDir);
            metalRebound.ResetProperties();
            return(metalRebound);
        }