Merge branch 'main' of ssh://gitfrieds.nackenbox.xyz:3011/MeigoFried/GameVsJam
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>();
|
||||
@ -237,9 +242,11 @@ public class Developer : MonoBehaviour
|
||||
_happiness += 0.2;
|
||||
}
|
||||
|
||||
_urgeToUrinateLevel -= caffeineAmount / 0.5f;
|
||||
_urgeToUrinateLevel -= caffeineAmount / 2.0;
|
||||
|
||||
_wantedDrink = WantedConsumable.None;
|
||||
|
||||
_npcAnimation.DrinkCoffee();
|
||||
}
|
||||
|
||||
public void GiveFood(double foodAmount, WantedConsumable foodType)
|
||||
@ -272,7 +279,7 @@ public class Developer : MonoBehaviour
|
||||
_happiness += 0.2;
|
||||
}
|
||||
|
||||
_urgeToUrinateLevel -= foodAmount / 0.5f;
|
||||
_urgeToUrinateLevel -= foodAmount / 2.0;
|
||||
|
||||
_wantedFood = WantedConsumable.None;
|
||||
}
|
||||
@ -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()
|
||||
|
||||
@ -153,15 +153,27 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private bool _won;
|
||||
|
||||
public bool Won => _won;
|
||||
|
||||
[SerializeField]
|
||||
private bool _lost;
|
||||
|
||||
public bool Lost => _lost;
|
||||
|
||||
private void EndGame(EndGameCondition endGameCondition)
|
||||
{
|
||||
if (endGameCondition.IsWin())
|
||||
{
|
||||
Debug.Log("You won!");
|
||||
_won = true;
|
||||
}
|
||||
else if (endGameCondition.IsLose())
|
||||
{
|
||||
Debug.Log("You lost!");
|
||||
_lost = true;
|
||||
}
|
||||
|
||||
Debug.Log(endGameCondition.GetEndGameMessage());
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using Interaction;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@ -37,12 +38,18 @@ public class UiController : MonoBehaviour
|
||||
[SerializeField] private TextMeshProUGUI _predictedEndText;
|
||||
|
||||
[SerializeField] private Gradient _deadlineTextColors;
|
||||
|
||||
public GameObject WinScreen;
|
||||
public GameObject LoseScreen;
|
||||
|
||||
void Update()
|
||||
{
|
||||
UpdateActionDisplay();
|
||||
UpdateProgressBar();
|
||||
UpdateDeadlineDateStuffTexts();
|
||||
|
||||
WinScreen.SetActive(GameManager.Instance.Won);
|
||||
LoseScreen.SetActive(GameManager.Instance.Lost);
|
||||
}
|
||||
|
||||
private void UpdateProgressBar()
|
||||
@ -59,7 +66,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);
|
||||
}
|
||||
|
||||
@ -97,4 +104,16 @@ public class UiController : MonoBehaviour
|
||||
//_prevActionButton.interactable = _pickupper.CanSelectPrevious;
|
||||
//_nextActionButton.interactable = _pickupper.CanSelectNext;
|
||||
}
|
||||
|
||||
public void Replay()
|
||||
{
|
||||
string currentSceneName = SceneManager.GetActiveScene().name;
|
||||
SceneManager.LoadScene(currentSceneName);
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user