public Weapon(Player owner, Keys shootKey, float damage, float coolDownTime) { // You know the deal: this.<variable> = variable; // ------------------------------------------------ this.owner = owner; this.damage = damage; this.shootKey = shootKey; this.coolDownTime = coolDownTime; coolDownTimeTicks = coolDownTime; SetBulletTexture(); OnTrigger += OnFire; }
public Bullet(Player owner, float angle, Texture2D texture, float speed = 10f, float r = 1, float g = 1, float b = 1) : base(owner.Position) { this.texture = texture; this.owner = owner; this.angle = angle; pos += owner.GunOffset; dir = owner.Direction; this.speed = speed; sprite = new Image(texture); width = sprite.Width; height = sprite.Height; flipped = owner.Flipped; Origin = new Vector2(width / 2, height / 2); tint = new Color(r, g, b); homing = owner.Tracking; }
/// <summary> /// Called when the OnTrigger event is triggered /// </summary> /// <param name="sender">Owner of the weapon</param> /// <param name="e">Leave null for now</param> protected abstract void OnFire(Player sender, EventArgs e);
public GatlingGun(Player owner, Keys shootKey) : base(owner, shootKey, 5f, 50f) { }
protected override void OnFire(Player sender, EventArgs e) { SoundManager.MissileLaunchInstance.Play(); Shoot(); }
public Pistol(Player owner, Keys shootKey) : base(owner, shootKey, 10f, 350f) { }
public override void StartEffect(Entities.Player sender, EventArgs e) { sender.EquippedWeapon = new MissileLauncher(sender, sender.ShootKey); }
public override void StartEffect(Entities.Player sender, EventArgs e) { sender.SuperSpeed = true; }
public override void EndEffect(Entities.Player sender, EventArgs e) { sender.SuperSpeed = false; }
public abstract void StartEffect(Player sender, EventArgs e);
public virtual void Update(GameTime gametime) { if (!destroyMe && !active) { foreach (Player p in GameplayState.Players) { if (p.Bounds.Intersects(Bounds)) { duration = 0; active = true; owner = p; OnEffectStart(owner, null); SoundManager.PowerUpInstance.Play(); } } } if (active) { duration += (float)gametime.ElapsedGameTime.Milliseconds; } if (duration >= MAXDURATION) { OneEffectEnd(owner, null); destroyMe = true; } }
public abstract void EndEffect(Player sender, EventArgs e);
protected override void OnFire(Player sender, EventArgs e) { laser.IsActive = true; }
public LaserGun(Player owner, Keys shootKey) : base(owner, shootKey, 5f, 10f) { laser = new Laser(owner, owner.Position); }
public Laser(Player owner, Vector2 pos) : base(pos) { this.owner = owner; angle = owner.Angle; }
public override void StartEffect(Entities.Player sender, EventArgs e) { sender.Health += 100; }
public Shotgun(Player owner, Keys shootKey) : base(owner, shootKey, 30f, 600f) { }
public override void EndEffect(Entities.Player sender, EventArgs e) { return; }
protected override void OnFire(Player sender, EventArgs e) { SoundManager.PistolShotInstance.Play(); Shoot(); }
public MissileLauncher(Player owner, Keys shootKey) : base(owner, shootKey, 70f, 500F) { }
public override void EndEffect(Entities.Player sender, EventArgs e) { sender.EquippedWeapon = new Pistol(sender, sender.ShootKey); }
public Bullet(Player owner, Texture2D texture) : this(owner, owner.Angle, texture) { }