Esempio n. 1
0
 /// <summary>
 /// Increase the Oxygen of this Player about the given amount.
 /// If the Oxygen is already on maxOxygen, this call is ignored.
 /// </summary>
 /// <param name="amount">Amount of Oxygen to add</param>
 public void IncreaseOxygen(Oxygen amount)
 {
     if (CurrentOxygen + amount <= MaxOxygen)
     {
         CurrentOxygen += amount;
     }
     else
     {
         CurrentOxygen = MaxOxygen;
     }
     OxygenLevelChanged?.Invoke(CurrentOxygen);
 }
Esempio n. 2
0
 /// <summary>
 /// Decrease the Oxygen of this Player about the given amount.
 /// If the Oxygen is 0 (or lower) IsAlive is set to false;
 /// </summary>
 /// <param name="amount">Amount of Oxygen to substract</param>
 public void DecreseOxygen(Oxygen amount)
 {
     if (CurrentOxygen > amount)
     {
         CurrentOxygen -= amount;
     }
     else
     {
         IsAlive       = false;
         CurrentOxygen = new Oxygen(0);
     }
     OxygenLevelChanged?.Invoke(CurrentOxygen);
 }