public void CreateShot(ShotFiredEventArgs args) { Sprite s = _tileSheet.SpriteAnimation(); Shot shot = new Shot(s, args.FiredBy, args.Damage); shot.Location = args.Location; shot.Velocity = args.Velocity * args.ShotSpeed; shot.OnDestroy += HandleOnShotDestroy; _shots.Add(shot); }
public void FireShot() { ShotFiredEventArgs args = new ShotFiredEventArgs { Location = Location + _gunOffset, ShotSpeed = ShotSpeed, FiredBy = FiredBy.Enemy, Damage = EnemyShotDamage // Don't know directional velocity because we don't know where the player is }; ShotFired?.Invoke(this, args); }
private void FireShot() { if (_shotTimer.Completed) { ShotFiredEventArgs args = new ShotFiredEventArgs { Location = Location + _gunOffset, Velocity = new Vector2(0, -1), // player can only fire on one direction ShotSpeed = ShotSpeed, FiredBy = FiredBy.Player // ShotBy = ShotBy.Player }; ShotFired?.Invoke(this, args); _shotTimer.Reset(); } }
private void EnemyShotFired(object sender, ShotFiredEventArgs e) { ShotFired?.Invoke(sender, e); }