Entwickler machen ein paar Sachen
This commit is contained in:
@ -122,6 +122,8 @@ public class Developer : MonoBehaviour
|
||||
private List<GameObject> _needList = new List<GameObject>();
|
||||
private bool _isDead = false;
|
||||
|
||||
[SerializeField] private NPCAnimationController _npcAnimation;
|
||||
|
||||
/// <summary>
|
||||
/// indicates wether the Dev is dead or not
|
||||
/// </summary>
|
||||
@ -146,6 +148,9 @@ public class Developer : MonoBehaviour
|
||||
private bool _hasTalkedWhileOvercaffeinated = false;
|
||||
private bool _hasTalkedBeforeSleeping = false;
|
||||
|
||||
public bool IsOvercaffeinated => _isOvercaffeinated;
|
||||
public bool IsHyperactive => _isHyperactive;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_developerNeeds = gameObject.GetComponent<DeveloperNeeds>();
|
||||
@ -240,6 +245,8 @@ public class Developer : MonoBehaviour
|
||||
_urgeToUrinateLevel -= caffeineAmount / 2.0;
|
||||
|
||||
_wantedDrink = WantedConsumable.None;
|
||||
|
||||
_npcAnimation.DrinkCoffee();
|
||||
}
|
||||
|
||||
public void GiveFood(double foodAmount, WantedConsumable foodType)
|
||||
@ -307,15 +314,23 @@ public class Developer : MonoBehaviour
|
||||
_caffeineLevel -= caffeineDrain * _baseStats.CaffeineDrainFactor;
|
||||
_hungerLevel -= hungerDrain * _baseStats.HungerDrainFactor;
|
||||
_urgeToUrinateLevel -= urinationDrain * _baseStats.UrinationDrainFactor;
|
||||
_happiness -= happinessDrain * _baseStats.UrinationDrainFactor;
|
||||
_happiness -= happinessDrain * _baseStats.HappinessDrainFactor;
|
||||
|
||||
_caffeineLevel = Math.Max(_caffeineLevel, 0.0);
|
||||
_hungerLevel = Math.Max(_hungerLevel, 0.0);
|
||||
_urgeToUrinateLevel = Math.Max(_urgeToUrinateLevel, 0.0);
|
||||
_happiness = Math.Max(_happiness, 0.0);
|
||||
|
||||
|
||||
_isHyperactive = _caffeineLevel > 1.0 && _caffeineLevel <= 1.5;
|
||||
|
||||
bool wasOvercaffeinated = _isOvercaffeinated;
|
||||
_isOvercaffeinated = _caffeineLevel > 1.5;
|
||||
|
||||
if (!wasOvercaffeinated && _isOvercaffeinated)
|
||||
{
|
||||
_npcAnimation.CaffeinOverdose();
|
||||
}
|
||||
|
||||
_isSleeping = _caffeineLevel <= 0.0;
|
||||
|
||||
if (_caffeineLevel < GameManager.Instance.NeedNotificationThreshold && _caffeineNeed == null)
|
||||
@ -351,6 +366,8 @@ public class Developer : MonoBehaviour
|
||||
|
||||
_toiletNeed = _developerNeeds.SpawnToiletNeed(_needList.Count);
|
||||
_needList.Add(_toiletNeed);
|
||||
|
||||
_npcAnimation.GoToToilet();
|
||||
}
|
||||
|
||||
if (_hungerLevel <= 0.0)
|
||||
@ -458,11 +475,13 @@ public class Developer : MonoBehaviour
|
||||
|
||||
private double CalculateUrinationEfficiency()
|
||||
{
|
||||
if (_urgeToUrinateLevel > 1.0)
|
||||
if (_urgeToUrinateLevel > GameManager.Instance.NeedNotificationThreshold)
|
||||
return 1.0;
|
||||
|
||||
// https://easings.net/#easeOutExpo
|
||||
return Math.Abs(_urgeToUrinateLevel - 1.0) < 0.0001f ? 1.0 : 1.0 - Math.Pow(2, -10 * _urgeToUrinateLevel);
|
||||
return _urgeToUrinateLevel / GameManager.Instance.NeedNotificationThreshold;
|
||||
|
||||
//Math.Abs(_urgeToUrinateLevel - 1.0) < 0.0001f ? 1.0 : 1.0 - Math.Pow(2, -10 * _urgeToUrinateLevel);
|
||||
}
|
||||
|
||||
private double CalculateHappinessEfficiency()
|
||||
|
||||
@ -47,7 +47,14 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
|
||||
double realSeconds = GameManager.Instance.ExpectedRemainingGameDuration;
|
||||
double gameDays = realSeconds / _secondsPerDay;
|
||||
|
||||
return CurrentDate.AddDays(gameDays);
|
||||
if (double.IsFinite(gameDays))
|
||||
{
|
||||
return CurrentDate.AddDays(gameDays);
|
||||
}
|
||||
else
|
||||
{
|
||||
return DateTime.MaxValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ public class UiController : MonoBehaviour
|
||||
{
|
||||
_currentDateText.text = $"Aktuelle Zeit: {TimeManager.Instance.CurrentDate: dddd dd.MM.yy hh U\\hr}";
|
||||
_deadlineText.text = $"Deadline: {TimeManager.Instance.Deadline: dddd dd.MM.yy hh U\\hr}";
|
||||
_predictedEndText.text = $"Vorraussichtlich fertig: {TimeManager.Instance.PredictedEndDate: dddd dd.MM.yy hh U\\hr}";
|
||||
_predictedEndText.text = $"Vorraussichtlich fertig: {(TimeManager.Instance.PredictedEndDate == DateTime.MaxValue ? "Nie" : TimeManager.Instance.PredictedEndDate.ToString("dddd dd.MM.yy hh U\\hr"))}";
|
||||
_predictedEndText.color = _deadlineTextColors.Evaluate(TimeManager.Instance.PredictedMissesDeadline ? 0.0f : 1.0f);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user