public Projectile(Ship owner, Vector2 direction, ShipModule moduleAttachedTo) { this.loyalty = owner.loyalty; this.owner = owner; if (!owner.isInDeepSpace) { this.system = owner.GetSystem(); } else { this.isInDeepSpace = true; } base.Position = moduleAttachedTo.Center; this.moduleAttachedTo = moduleAttachedTo; this.Center = moduleAttachedTo.Center; this.emitter.Position = new Vector3(moduleAttachedTo.Center, 0f); }
public Projectile LoadProjectiles(Vector2 direction, Ship owner) { Projectile projectile = new Projectile(owner, direction) { range = this.Range, weapon = this, explodes = this.explodes, damageAmount = this.DamageAmount }; projectile.explodes = this.explodes; projectile.damageRadius = this.DamageRadius; projectile.explosionradiusmod = this.ExplosionRadiusVisual; projectile.speed = this.ProjectileSpeed; projectile.WeaponEffectType = this.WeaponEffectType; projectile.WeaponType = this.WeaponType; projectile.Initialize(this.ProjectileSpeed, direction, owner.Center); projectile.Radius = this.ProjectileRadius; projectile.LoadContent(this.ProjectileTexturePath, this.ModelPath); if (owner.GetSystem() != null && owner.GetSystem().isVisible || owner.isInDeepSpace) { int numberSameWeapons = 0; //this.toggleTimer = 0f; foreach (Weapon w in owner.Weapons) { if (w == this || !(w.Name == this.Name) || w.timeToNextFire > 0f) { continue; } numberSameWeapons++; } projectile.DieSound = true; if (!string.IsNullOrEmpty(ResourceManager.WeaponsDict[this.UID].dieCue)) { projectile.dieCueName = ResourceManager.WeaponsDict[this.UID].dieCue; } if (!string.IsNullOrEmpty(this.InFlightCue)) { projectile.InFlightCue = this.InFlightCue; } } return projectile; }