Exemple #1
0
        public MP5Imbalance(float xval, float yval)
            : base(xval, yval)
        {
            ammo                  = MaxAmmo;
            _ammoType             = new ATMissile();
            _ammoType.penetration = 2f;
            _ammoType.range       = 200f;
            _ammoType.accuracy    = 1f;

            _type       = "gun";
            _editorName = "MP5";
            graphic     = new SpriteMap(DuckUtils.GetAsset("weapons/mp5_imba.png"), 24, 14);

            center          = new Vec2(8f, 4f);
            collisionOffset = new Vec2(-8f, -4f);
            collisionSize   = new Vec2(20f, 10f);

            _barrelOffsetTL = new Vec2(23f, 5f);
            _fireSound      = DuckUtils.GetAsset("sounds/mp5_imba_shot.wav");
            _fullAuto       = true;
            _fireWait       = 0f;
            _kickForce      = 0.4f;
            _holdOffset     = new Vec2(-5f, -3f);

            storeSound   = new NetSoundEffect(DuckUtils.GetAsset("sounds/mp5_imba_store.wav"));
            SoundBinding = new NetSoundBinding("storeSound");
        }
 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));
 }
        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);
            }
        }
Exemple #4
0
 public void setquack(List <string> common, List <string> rare)
 {
     quackeff = new ExNetSFX(common, rare) as NetSoundEffect;
     //quackeff = new NetSoundEffect(common, rare);
 }
Exemple #5
0
 public void setquack(string[] paths)
 {
     quackeff = new ExNetSFX(paths) as NetSoundEffect;
     //quackeff = new NetSoundEffect(paths);
 }
Exemple #6
0
 public void setquack(string path)
 {
     quackeff = new NetSoundEffect(path);
 }