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); } }
public override void Update() { base.Update(); ammo = MaxAmmo; if (duck != null) { StoredItem stored = PurpleBlock.GetStoredItem(duck.profile); if (stored.type == GetType()) { storeSound.Play(); duck.onFire = true; duck.Zap(this); stored.sprite = null; stored.type = null; stored.thing = null; } } }
public override void Quack(float volume, float pitch) { //if (equippedDuck.inputProfile.rightTrigger != 0) // pitch = -equippedDuck.inputProfile.rightTrigger; quackeff.Play(volume, pitch); }