protected virtual void CreateDroneBeam(Vector2 destination, GameplayObject target, DroneAI source) { if (source == null) return; Beam beam = new Beam(source.Owner.Center, target.Center, this.BeamThickness, source.Owner, target); beam.moduleAttachedTo = this.moduleAttachedTo; beam.PowerCost = (float)this.BeamPowerCostPerSecond; beam.range = this.Range; beam.thickness = this.BeamThickness; beam.Duration = (float)this.BeamDuration > 0 ? this.BeamDuration : 2f; beam.damageAmount = this.DamageAmount; beam.weapon = this; if(!beam.LoadContent(Weapon.universeScreen.ScreenManager, Weapon.universeScreen.view, Weapon.universeScreen.projection)) { beam.Die(null, true); return; } source.Beams.Add(beam); this.ToggleSoundOn = false; if (Weapon.universeScreen.viewState <= UniverseScreen.UnivScreenState.SystemView) { //Added by McShooterz: Use sounds from new sound dictionary if (ResourceManager.SoundEffectDict.ContainsKey(this.fireCueName)) { AudioManager.PlaySoundEffect(ResourceManager.SoundEffectDict[fireCueName], Weapon.audioListener, source.Owner.emitter, 0.5f); } else { if (!string.IsNullOrEmpty(this.fireCueName)) { this.fireCue = AudioManager.GetCue(this.fireCueName); this.fireCue.Apply3D(Weapon.audioListener, source.Owner.emitter); this.fireCue.Play(); } } if (!string.IsNullOrEmpty(this.ToggleSoundName)) { this.ToggleSoundOn = true; this.ToggleCue = AudioManager.GetCue(this.ToggleSoundName); this.ToggleCue.Apply3D(Weapon.audioListener, source.Owner.emitter); this.ToggleCue.Play(); } } }
protected virtual void CreateMouseBeam(Vector2 destination) { Beam beam = new Beam(this.moduleAttachedTo.Center, destination, this.BeamThickness, this.moduleAttachedTo.GetParent()) { moduleAttachedTo = this.moduleAttachedTo, range = this.Range, followMouse = true, thickness = this.BeamThickness, Duration = (float)this.BeamDuration > 0 ? this.BeamDuration : 2f, PowerCost = (float)this.BeamPowerCostPerSecond, damageAmount = this.DamageAmount, weapon = this }; beam.LoadContent(Weapon.universeScreen.ScreenManager, Weapon.universeScreen.view, Weapon.universeScreen.projection); if (beam == null || !beam.Active) { beam.Die(null, true); return; } this.moduleAttachedTo.GetParent().Beams.Add(beam); this.ToggleSoundOn = false; if ((this.owner.GetSystem() != null && this.owner.GetSystem().isVisible || this.owner.isInDeepSpace) && Weapon.universeScreen.viewState <= UniverseScreen.UnivScreenState.SystemView) { //Added by McShooterz: Use sounds from new sound dictionary if (ResourceManager.SoundEffectDict.ContainsKey(this.fireCueName)) { AudioManager.PlaySoundEffect(ResourceManager.SoundEffectDict[fireCueName], Weapon.audioListener, this.owner.emitter, 0.5f); } else { if (!string.IsNullOrEmpty(this.fireCueName)) { this.fireCue = AudioManager.GetCue(this.fireCueName); if (!this.owner.isPlayerShip()) { this.fireCue.Apply3D(Weapon.audioListener, this.owner.emitter); } this.fireCue.Play(); } } if (!string.IsNullOrEmpty(this.ToggleSoundName) && !this.ToggleSoundOn) { this.ToggleSoundOn = true; this.ToggleCue = AudioManager.GetCue(this.ToggleSoundName); this.ToggleCue.Apply3D(Weapon.audioListener, this.owner.emitter); this.ToggleCue.Play(); } } }
protected virtual void CreateTargetedBeam(GameplayObject target) { Beam beam; //if (this.owner.Beams.pendingRemovals.TryPop(out beam)) //{ // //beam = new Beam(this.moduleAttachedTo.Center, this.BeamThickness, this.moduleAttachedTo.GetParent(), target); // beam.BeamRecreate(this.moduleAttachedTo.Center, this.BeamThickness, this.moduleAttachedTo.GetParent(), target); // beam.moduleAttachedTo = this.moduleAttachedTo; // beam.PowerCost = (float)this.BeamPowerCostPerSecond; // beam.range = this.Range; // beam.thickness = this.BeamThickness; // beam.Duration = (float)this.BeamDuration > 0 ? this.BeamDuration : 2f; // beam.damageAmount = this.DamageAmount; // beam.weapon = this; //} //else { beam = new Beam(this.moduleAttachedTo.Center, this.BeamThickness, this.moduleAttachedTo.GetParent(), target) { moduleAttachedTo = this.moduleAttachedTo, PowerCost = (float)this.BeamPowerCostPerSecond, range = this.Range, thickness = this.BeamThickness, Duration = (float)this.BeamDuration > 0 ? this.BeamDuration : 2f, damageAmount = this.DamageAmount, weapon = this, Destination=target.Center }; } //damage increase by level if (this.owner.Level > 0) { beam.damageAmount += beam.damageAmount * (float)this.owner.Level * 0.05f; } //Hull bonus damage increase if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useHullBonuses) { HullBonus mod; if (ResourceManager.HullBonuses.TryGetValue(this.owner.shipData.Hull, out mod)) beam.damageAmount += beam.damageAmount * mod.DamageBonus; } this.ModifyProjectile(beam); if ( !beam.LoadContent(Weapon.universeScreen.ScreenManager, Weapon.universeScreen.view, Weapon.universeScreen.projection)) { beam.Die(null, true); return; } this.moduleAttachedTo.GetParent().Beams.Add(beam); this.ToggleSoundOn = false; if (Weapon.universeScreen.viewState <= UniverseScreen.UnivScreenState.SystemView && this.moduleAttachedTo.GetParent().InFrustum) { //Added by McShooterz: Use sounds from new sound dictionary SoundEffect beamsound = null; if (ResourceManager.SoundEffectDict.TryGetValue(this.fireCueName,out beamsound)) { AudioManager.PlaySoundEffect(beamsound, Weapon.audioListener, this.owner.emitter, 0.5f); } else { if (!string.IsNullOrEmpty(this.fireCueName)) { this.fireCue = AudioManager.GetCue(this.fireCueName); if (!this.owner.isPlayerShip()) { this.fireCue.Apply3D(Weapon.audioListener, this.owner.emitter); } this.fireCue.Play(); } } if (!string.IsNullOrEmpty(this.ToggleSoundName)) { this.ToggleSoundOn = true; this.ToggleCue = AudioManager.GetCue(this.ToggleSoundName); this.ToggleCue.Apply3D(Weapon.audioListener, this.owner.emitter); this.ToggleCue.Play(); } } }