public void InitializeDrone(float initialSpeed, Vector2 direction)
 {
     //this.isDrone = true;
     this.direction = direction;
     if (this.moduleAttachedTo != null)
     {
         this.Center = this.moduleAttachedTo.Center;
     }
     this.velocity = (initialSpeed * direction) + (this.owner != null ? this.owner.Velocity : Vector2.Zero);
     this.radius = 1f;
     this.velocityMaximum = initialSpeed + (this.owner != null ? this.owner.Velocity.Length() : 0f);
     this.duration = this.range / initialSpeed;
     Projectile projectile = this;
     projectile.duration = projectile.duration + this.duration * 0.25f;
     this.initialDuration = this.duration;
     if (this.weapon.Animated == 1)
     {
         this.switchFrames = this.initialDuration / (float)this.weapon.Frames;
         if (this.weapon.LoopAnimation == 1)
         {
             this.AnimationFrame = (int)((this.system != null ? this.system.RNG : Ship.universeScreen.DeepSpaceRNG)).RandomBetween(0f, (float)(this.weapon.Frames - 1));
         }
     }
     Projectile projectile1 = this;
     projectile1.particleDelay = projectile1.particleDelay + this.weapon.particleDelay;
     if (this.weapon.IsRepairDrone)
     {
         this.droneAI = new DroneAI(this);
     }
     if (this.system == null)
     {
         Projectile.universeScreen.DSProjectilesToAdd.Add(this);
         UniverseScreen.DeepSpaceManager.CollidableProjectiles.Add(this);
     }
     else
     {
         //this.system.spatialManager.CollidableProjectiles.Add(this);
         //this.system.spatialManager.CollidableObjects.Add(this);
         //lock (GlobalStats.BucketLock)
         {
             this.system.spatialManager.CollidableProjectiles.Add(this);
             this.system.spatialManager.RegisterObject(this);
             this.system.spatialManager.CollidableObjects.Add(this);
         }
     }
     base.Initialize();
 }
        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 Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    if (this.droneAI != null)
                        this.droneAI.Dispose();

                }
                this.droneAI = null;
                this.disposed = true;
            }
        }
 public virtual void FireDroneBeam(Vector2 direction, GameplayObject target, DroneAI source)
 {
     this.drowner = source.Owner;
     if (this.timeToNextFire > 0f)
     {
         return;
     }
     this.timeToNextFire = this.fireDelay;
     this.CreateDroneBeam(direction, target, source);
 }