コード例 #1
0
 public void EnergyUp(int amount)
 {
     if (_energy < _maxEnergy)
     {
         _energy = _energy + amount > _maxEnergy ? _maxEnergy : _energy + amount;
         DisplayNotification?.Invoke
             ($"{DateTime.Now.ToLongTimeString()} - Spaceship has been repaired for {amount}! Remaining energy: {Energy}");
     }
 }
コード例 #2
0
 private void DestroyAsteroid() =>
 DisplayNotification?.Invoke($"{DateTime.Now.ToLongTimeString()} - Asteroid has been destroyed!");
コード例 #3
0
 public void Die()
 {
     DisplayNotification?.Invoke($"{DateTime.Now.ToLongTimeString()} - Spaceship has been destroyed!");
     MessageDie?.Invoke();
 }
コード例 #4
0
 public void EnergyLow(int amount)
 {
     _energy -= amount;
     DisplayNotification?.Invoke
         ($"{DateTime.Now.ToLongTimeString()} - Spaceship got {amount} damage! Remaining energy: {Energy}");
 }