示例#1
0
 private void SetMood(float newMood)
 {
     if (CheckIfNumberIsPercent(newMood))
     {
         _moodLevel = newMood;
         MoodChanged?.Invoke(this, new ValueChangedEventArgs(newMood));
         UpdateHealth();
     }
 }
示例#2
0
 /// <summary>
 /// Public method to directly set this creature's mood to a particular level.
 /// Use positive numbers for happiness and negative numbers to make them sad/angry
 /// </summary>
 /// <param name="amount"></param>
 public void SetLevel(int amount)
 {
     // maybe do a happy/unhappy face animation to represent this change?
     level = Mathf.Clamp(amount, 0, maxMoodLevel);
     MoodChanged?.Invoke();
 }