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 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); }
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); }
public override void OnPressAction() { if (this.ammo > 0) { this._sprite.SetAnimation("fire"); for (int index = 0; index < 3; ++index) { Vec2 vec2 = this.Offset(new Vec2(-9f, 0.0f)); Vec2 hitAngle = this.barrelVector.Rotate(Rando.Float(1f), Vec2.Zero); Level.Add((Thing)Spark.New(vec2.x, vec2.y, hitAngle, 0.1f)); } } else { this._sprite.SetAnimation("empty"); } this.Fire(); }
public void Fire(Vec2 point, Vec2 travel) { if (!this._inGun) { return; } this._inGun = false; this.position = point + travel * -2f; this._stuck = true; if (!this.noisy) { return; } SFX.Play("grappleHook", 0.5f); for (int index = 0; index < 6; ++index) { Level.Add((Thing)Spark.New(point.x - travel.x * 2f, point.y - travel.y * 2f, travel)); } for (int index = 0; index < 1; ++index) { Level.Add((Thing)SmallSmoke.New(point.x + Rando.Float(-2f, 2f), point.y + Rando.Float(-2f, 2f))); } }
public override void OnPressAction() { if (this.loaded && this.ammo > 1) { base.OnPressAction(); for (int index = 0; index < 4; ++index) { Level.Add((Thing)Spark.New(this.offDir > (sbyte)0 ? this.x - 9f : this.x + 9f, this.y - 6f, new Vec2(Rando.Float(-1f, 1f), -0.5f), 0.05f)); } for (int index = 0; index < 4; ++index) { Level.Add((Thing)SmallSmoke.New(this.barrelPosition.x + (float)this.offDir * 4f, this.barrelPosition.y)); } this.ammo = 1; } else { if (this._loadState != -1) { return; } this._loadState = 0; } }
public override void Update() { if (this._sprite == null) { return; } Vec2 vec2_1 = this.Offset(new Vec2(-6f, -4f)); if (this._lit && (bool)this._timer) { Level.Add((Thing)Spark.New(vec2_1.x, vec2_1.y, new Vec2(Rando.Float(-1f, 1f), -0.5f), 0.1f)); } if (this._lit && this._litTimer != null && ((bool)this._litTimer && this._litStartTimer != null) && (bool)this._litStartTimer) { if (this._sprite.frame == 0) { this._sprite.frame = 1; } if (this.owner == null) { this.y -= 6f; } --this.ammo; SFX.Play("netGunFire", 0.5f, Rando.Float(0.2f) - 0.4f); this.kick = 1f; if (this.isServerForObject) { Vec2 vec2_2 = this.Offset(this.barrelOffset); CandleBall candleBall = new CandleBall(vec2_2.x, vec2_2.y, (FlareGun)this, 4); this.Fondle((Thing)candleBall); Vec2 vec = Maths.AngleToVec(this.barrelAngle + Rando.Float(-0.1f, 0.1f)); candleBall.hSpeed = vec.x * 14f; candleBall.vSpeed = vec.y * 14f; Level.Add((Thing)candleBall); } if (this.owner == null) { this.hSpeed -= (float)this._flip * Rando.Float(1f, 5f); this.vSpeed -= Rando.Float(1f, 7f); this._flip = this._flip <= 0 ? 1 : -1; } this.offDir = (sbyte)this._flip; } if (this.ammo <= 0) { this._lit = false; this._sprite.frame = 2; if (this._burnSound != null) { this._burnSound.Stop(); this._burnSound = (Sound)null; } } base.Update(); if (this.owner != null) { this._flip = (int)this.owner.offDir; } else { this.graphic.flipH = this._flip < 0; } }