public void Update() { if (AvaibleLaserShots < _maxLaserBullets) { if (_time < _laserRecoverTime) { _time++; } else { _time = 0; AvaibleLaserShots++; LaserValueChanged?.Invoke(this, AvaibleLaserShots); } } }
public Laser FireWithLaser(float padding) { if (IsReadyToFire && AvaibleLaserShots > 0) { Axes2D axes = new Axes2D(new Point2D(0, 0), _player.Rotation); Point2D shotPoint = new Point2D(_player.Pivot.X, _player.Pivot.Y); shotPoint += axes.Y * padding; Laser laser = new Laser(_laserPoints, shotPoint, _player, padding); laser.LifeTime = _laserLifeTime; laser.Rotate(_player.Rotation); IsReadyToFire = false; AvaibleLaserShots--; LaserValueChanged?.Invoke(this, AvaibleLaserShots); return(laser); } return(null); }