Merge branch 'main' of ssh://gitfrieds.nackenbox.xyz:3011/MeigoFried/GameVsJam

This commit is contained in:
klappstuhl24 2024-04-08 21:31:40 +02:00
commit 288678f3b5
11 changed files with 2109 additions and 82 deletions

View File

@ -16,6 +16,11 @@ public class NPCAnimationController : MonoBehaviour
private NavMeshAgent agent; private NavMeshAgent agent;
private Animator animator; private Animator animator;
public Developer Developer;
[SerializeField]
private bool _canTakeNewJob;
private void Awake() private void Awake()
{ {
agent = GetComponent<NavMeshAgent>(); agent = GetComponent<NavMeshAgent>();
@ -25,20 +30,22 @@ public class NPCAnimationController : MonoBehaviour
} }
private IEnumerator GetToWorkRoutine() private IEnumerator GetToWorkRoutine()
{ {
yield return TakeLock();
animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 0); animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 0);
animator.SetTrigger("Walk"); animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack"));
MoveTo(workPosition.position); MoveTo(workPosition.position);
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zur<EFBFBD>ck
animator.SetTrigger("SitDown"); animator.SetTrigger("SitDown");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit"));
transform.rotation = workPosition.rotation; transform.rotation = workPosition.rotation;
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f)); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f));
ReleaseLock();
} }
private IEnumerator FadeLayerWeight(int layerIndex, float targetWeight, float duration) private IEnumerator FadeLayerWeight(int layerIndex, float targetWeight, float duration)
{ {
float time = 0; float time = 0;
@ -56,14 +63,24 @@ public class NPCAnimationController : MonoBehaviour
public void DrinkCoffee() public void DrinkCoffee()
{ {
StartCoroutine(DrinkCoffeeRoutine()); StartCoroutine(DrinkCoffeeRoutine());
}
private IEnumerator TakeLock()
{
yield return new WaitUntil(() => _canTakeNewJob);
_canTakeNewJob = false;
}
private void ReleaseLock()
{
_canTakeNewJob = true;
} }
private IEnumerator DrinkCoffeeRoutine() private IEnumerator DrinkCoffeeRoutine()
{ {
yield return TakeLock();
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 1, 1f)); // 1 Sekunde zum Einblenden yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 1, 1f)); // 1 Sekunde zum Einblenden
animator.SetTrigger("DrinkCoffee"); animator.SetTrigger("DrinkCoffee");
@ -78,7 +95,7 @@ public class NPCAnimationController : MonoBehaviour
animator.ResetTrigger("DrinkCoffee"); animator.ResetTrigger("DrinkCoffee");
Cup.SetActive(true); Cup.SetActive(true);
ReleaseLock();
} }
public void GoToToilet() public void GoToToilet()
@ -88,7 +105,17 @@ public class NPCAnimationController : MonoBehaviour
private IEnumerator GoToToiletRoutine() private IEnumerator GoToToiletRoutine()
{ {
yield return TakeLock();
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f)); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f));
while (ToiletManager.Instance.IsOccupied)
{
yield return new WaitForSeconds(2);
}
ToiletManager.Instance.IsOccupied = true;
// Beginne mit dem Laufen zur Toilette. // Beginne mit dem Laufen zur Toilette.
animator.SetTrigger("Walk"); animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Walk")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Walk"));
@ -97,24 +124,33 @@ public class NPCAnimationController : MonoBehaviour
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
// Hört auf zu laufen und beginnt zu sitzen. // H<EFBFBD>rt auf zu laufen und beginnt zu sitzen.
animator.ResetTrigger("Walk"); // Es ist wichtig, den vorherigen Trigger zurückzusetzen animator.ResetTrigger("Walk"); // Es ist wichtig, den vorherigen Trigger zur<EFBFBD>ckzusetzen
transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z)); transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z));
animator.SetTrigger("SitDown"); animator.SetTrigger("SitDown");
transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z)); transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z));
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Ready")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Ready"));
// Stehe auf und gehe zurück zum Ausgangspunkt.
Developer.Pee(1.0, true);
// Stehe auf und gehe zur<75>ck zum Ausgangspunkt.
transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z)); transform.LookAt(new Vector3(toiletLookAtTransform.position.x, toiletLookAtTransform.position.y, toiletLookAtTransform.position.z));
animator.ResetTrigger("SitDown"); // Setze den Sitzen-Trigger zurück animator.ResetTrigger("SitDown"); // Setze den Sitzen-Trigger zur<75>ck
ToiletManager.Instance.IsOccupied = false;
animator.SetTrigger("Walk"); animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack"));
MoveTo(workPosition.position); MoveTo(workPosition.position);
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zur<EFBFBD>ck
animator.SetTrigger("SitDown"); animator.SetTrigger("SitDown");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit"));
transform.rotation = workPosition.rotation; transform.rotation = workPosition.rotation;
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f)); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f));
ReleaseLock();
} }
// Hier kannst du entscheiden, ob der Charakter wieder sitzt oder steht. // Hier kannst du entscheiden, ob der Charakter wieder sitzt oder steht.
// Beispiel: Setze IsSitting oder IsStanding entsprechend. // Beispiel: Setze IsSitting oder IsStanding entsprechend.
@ -126,12 +162,15 @@ public class NPCAnimationController : MonoBehaviour
private IEnumerator GettingMadRoutine() private IEnumerator GettingMadRoutine()
{ {
yield return TakeLock();
animator.SetTrigger("GetMad"); animator.SetTrigger("GetMad");
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 1, 2f)); // 1 Sekunde zum Einblenden yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 1, 2f)); // 1 Sekunde zum Einblenden
yield return new WaitForSeconds(8f); yield return new WaitForSeconds(8f);
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 0, 1f)); // 1 Sekunde zum Ausblenden yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 0, 1f)); // 1 Sekunde zum Ausblenden
animator.ResetTrigger("GetMad"); animator.ResetTrigger("GetMad");
ReleaseLock();
} }
public void CaffeinOverdose() public void CaffeinOverdose()
@ -141,6 +180,8 @@ public class NPCAnimationController : MonoBehaviour
private IEnumerator CaffeinRoutine() private IEnumerator CaffeinRoutine()
{ {
yield return TakeLock();
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f)); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f));
// Beginne mit dem Laufen zur Toilette. // Beginne mit dem Laufen zur Toilette.
animator.SetTrigger("Walk"); animator.SetTrigger("Walk");
@ -149,24 +190,23 @@ public class NPCAnimationController : MonoBehaviour
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
animator.ResetTrigger("Walk"); animator.ResetTrigger("Walk");
animator.SetTrigger("TooMuchCaffein"); animator.SetTrigger("TooMuchCaffein");
yield return new WaitForSeconds(8f);
yield return new WaitWhile(() => Developer.IsOvercaffeinated);
animator.ResetTrigger("TooMuchCaffein"); animator.ResetTrigger("TooMuchCaffein");
animator.SetTrigger("Walk"); animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack"));
MoveTo(workPosition.position); MoveTo(workPosition.position);
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
transform.rotation = workPosition.rotation; transform.rotation = workPosition.rotation;
animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zur<EFBFBD>ck
animator.SetTrigger("SitDown"); animator.SetTrigger("SitDown");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit"));
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f)); yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f));
ReleaseLock();
} }
private void MoveTo(Vector3 destination) private void MoveTo(Vector3 destination)
{ {
agent.destination = destination; agent.destination = destination;
@ -175,28 +215,27 @@ public class NPCAnimationController : MonoBehaviour
private void Update() private void Update()
{ {
// Prüft, ob der Buchstabe 'C' gedrückt wurde // Pr<EFBFBD>ft, ob der Buchstabe 'C' gedr<64>ckt wurde
if (Input.GetKeyDown(KeyCode.C)) if (Input.GetKeyDown(KeyCode.C))
{ {
DrinkCoffee(); DrinkCoffee();
} }
// Prüft, ob der Buchstabe 'T' gedrückt wurde // Pr<EFBFBD>ft, ob der Buchstabe 'T' gedr<64>ckt wurde
if (Input.GetKeyDown(KeyCode.T)) if (Input.GetKeyDown(KeyCode.T))
{ {
GoToToilet(); GoToToilet();
} }
// Prüft, ob der Buchstabe 'M' gedrückt wurde // Pr<EFBFBD>ft, ob der Buchstabe 'M' gedr<64>ckt wurde
if (Input.GetKeyDown(KeyCode.M)) if (Input.GetKeyDown(KeyCode.M))
{ {
GettingMad(); GettingMad();
} }
// Prüft, ob der Buchstabe 'C' gedrückt wurde // Pr<EFBFBD>ft, ob der Buchstabe 'C' gedr<64>ckt wurde
if (Input.GetKeyDown(KeyCode.O)) if (Input.GetKeyDown(KeyCode.O))
{ {
CaffeinOverdose(); CaffeinOverdose();
} }
} }
} }

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 73951a4b66414d24999d439134425a40
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -38,7 +38,7 @@ public class DeveloperInfoUi : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
_happinessImage.color = _statusGradient.Evaluate((float)_developer.CurrentUrgeToUrinate); _happinessImage.color = _statusGradient.Evaluate((float)_developer.CurrentHappiness);
_caffeineImage.color = _statusGradient.Evaluate((float)_developer.CurrentCaffeination); _caffeineImage.color = _statusGradient.Evaluate((float)_developer.CurrentCaffeination);
_hungerImage.color = _statusGradient.Evaluate((float)_developer.CurrentHunger); _hungerImage.color = _statusGradient.Evaluate((float)_developer.CurrentHunger);
_toiletImage.color = _statusGradient.Evaluate((float)_developer.CurrentUrgeToUrinate); _toiletImage.color = _statusGradient.Evaluate((float)_developer.CurrentUrgeToUrinate);

View File

@ -6,7 +6,7 @@ TextureImporter:
serializedVersion: 12 serializedVersion: 12
mipmaps: mipmaps:
mipMapMode: 0 mipMapMode: 0
enableMipMap: 1 enableMipMap: 0
sRGBTexture: 1 sRGBTexture: 1
linearTexture: 0 linearTexture: 0
fadeOut: 0 fadeOut: 0
@ -37,24 +37,24 @@ TextureImporter:
filterMode: 1 filterMode: 1
aniso: 1 aniso: 1
mipBias: 0 mipBias: 0
wrapU: 0 wrapU: 1
wrapV: 0 wrapV: 1
wrapW: 0 wrapW: 0
nPOTScale: 1 nPOTScale: 0
lightmap: 0 lightmap: 0
compressionQuality: 50 compressionQuality: 50
spriteMode: 0 spriteMode: 1
spriteExtrude: 1 spriteExtrude: 1
spriteMeshType: 1 spriteMeshType: 0
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 300, y: 300, z: 300, w: 300}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
alphaIsTransparency: 0 alphaIsTransparency: 1
spriteTessellationDetail: -1 spriteTessellationDetail: -1
textureType: 0 textureType: 8
textureShape: 1 textureShape: 1
singleChannelComponent: 0 singleChannelComponent: 0
flipbookRows: 1 flipbookRows: 1
@ -112,8 +112,8 @@ TextureImporter:
outline: [] outline: []
physicsShape: [] physicsShape: []
bones: [] bones: []
spriteID: spriteID: 5e97eb03825dee720800000000000000
internalID: 0 internalID: 1537655665
vertices: [] vertices: []
indices: indices:
edges: [] edges: []

File diff suppressed because it is too large Load Diff

View File

@ -122,6 +122,8 @@ public class Developer : MonoBehaviour
private List<GameObject> _needList = new List<GameObject>(); private List<GameObject> _needList = new List<GameObject>();
private bool _isDead = false; private bool _isDead = false;
[SerializeField] private NPCAnimationController _npcAnimation;
/// <summary> /// <summary>
/// indicates wether the Dev is dead or not /// indicates wether the Dev is dead or not
/// </summary> /// </summary>
@ -146,6 +148,9 @@ public class Developer : MonoBehaviour
private bool _hasTalkedWhileOvercaffeinated = false; private bool _hasTalkedWhileOvercaffeinated = false;
private bool _hasTalkedBeforeSleeping = false; private bool _hasTalkedBeforeSleeping = false;
public bool IsOvercaffeinated => _isOvercaffeinated;
public bool IsHyperactive => _isHyperactive;
void Start() void Start()
{ {
_developerNeeds = gameObject.GetComponent<DeveloperNeeds>(); _developerNeeds = gameObject.GetComponent<DeveloperNeeds>();
@ -237,9 +242,11 @@ public class Developer : MonoBehaviour
_happiness += 0.2; _happiness += 0.2;
} }
_urgeToUrinateLevel -= caffeineAmount / 0.5f; _urgeToUrinateLevel -= caffeineAmount / 2.0;
_wantedDrink = WantedConsumable.None; _wantedDrink = WantedConsumable.None;
_npcAnimation.DrinkCoffee();
} }
public void GiveFood(double foodAmount, WantedConsumable foodType) public void GiveFood(double foodAmount, WantedConsumable foodType)
@ -272,7 +279,7 @@ public class Developer : MonoBehaviour
_happiness += 0.2; _happiness += 0.2;
} }
_urgeToUrinateLevel -= foodAmount / 0.5f; _urgeToUrinateLevel -= foodAmount / 2.0;
_wantedFood = WantedConsumable.None; _wantedFood = WantedConsumable.None;
} }
@ -307,7 +314,7 @@ public class Developer : MonoBehaviour
_caffeineLevel -= caffeineDrain * _baseStats.CaffeineDrainFactor; _caffeineLevel -= caffeineDrain * _baseStats.CaffeineDrainFactor;
_hungerLevel -= hungerDrain * _baseStats.HungerDrainFactor; _hungerLevel -= hungerDrain * _baseStats.HungerDrainFactor;
_urgeToUrinateLevel -= urinationDrain * _baseStats.UrinationDrainFactor; _urgeToUrinateLevel -= urinationDrain * _baseStats.UrinationDrainFactor;
_happiness -= happinessDrain * _baseStats.UrinationDrainFactor; _happiness -= happinessDrain * _baseStats.HappinessDrainFactor;
_caffeineLevel = Math.Max(_caffeineLevel, 0.0); _caffeineLevel = Math.Max(_caffeineLevel, 0.0);
_hungerLevel = Math.Max(_hungerLevel, 0.0); _hungerLevel = Math.Max(_hungerLevel, 0.0);
@ -315,7 +322,15 @@ public class Developer : MonoBehaviour
_happiness = Math.Max(_happiness, 0.0); _happiness = Math.Max(_happiness, 0.0);
_isHyperactive = _caffeineLevel > 1.0 && _caffeineLevel <= 1.5; _isHyperactive = _caffeineLevel > 1.0 && _caffeineLevel <= 1.5;
bool wasOvercaffeinated = _isOvercaffeinated;
_isOvercaffeinated = _caffeineLevel > 1.5; _isOvercaffeinated = _caffeineLevel > 1.5;
if (!wasOvercaffeinated && _isOvercaffeinated)
{
_npcAnimation.CaffeinOverdose();
}
_isSleeping = _caffeineLevel <= 0.0; _isSleeping = _caffeineLevel <= 0.0;
if (_caffeineLevel < GameManager.Instance.NeedNotificationThreshold && _caffeineNeed == null) if (_caffeineLevel < GameManager.Instance.NeedNotificationThreshold && _caffeineNeed == null)
@ -351,6 +366,8 @@ public class Developer : MonoBehaviour
_toiletNeed = _developerNeeds.SpawnToiletNeed(_needList.Count); _toiletNeed = _developerNeeds.SpawnToiletNeed(_needList.Count);
_needList.Add(_toiletNeed); _needList.Add(_toiletNeed);
_npcAnimation.GoToToilet();
} }
if (_hungerLevel <= 0.0) if (_hungerLevel <= 0.0)
@ -458,11 +475,13 @@ public class Developer : MonoBehaviour
private double CalculateUrinationEfficiency() private double CalculateUrinationEfficiency()
{ {
if (_urgeToUrinateLevel > 1.0) if (_urgeToUrinateLevel > GameManager.Instance.NeedNotificationThreshold)
return 1.0; return 1.0;
// https://easings.net/#easeOutExpo // 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() private double CalculateHappinessEfficiency()

View File

@ -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) private void EndGame(EndGameCondition endGameCondition)
{ {
if (endGameCondition.IsWin()) if (endGameCondition.IsWin())
{ {
Debug.Log("You won!"); Debug.Log("You won!");
_won = true;
} }
else if (endGameCondition.IsLose()) else if (endGameCondition.IsLose())
{ {
Debug.Log("You lost!"); Debug.Log("You lost!");
_lost = true;
} }
Debug.Log(endGameCondition.GetEndGameMessage()); Debug.Log(endGameCondition.GetEndGameMessage());

View File

@ -47,8 +47,15 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
double realSeconds = GameManager.Instance.ExpectedRemainingGameDuration; double realSeconds = GameManager.Instance.ExpectedRemainingGameDuration;
double gameDays = realSeconds / _secondsPerDay; double gameDays = realSeconds / _secondsPerDay;
if (double.IsFinite(gameDays))
{
return CurrentDate.AddDays(gameDays); return CurrentDate.AddDays(gameDays);
} }
else
{
return DateTime.MaxValue;
}
}
} }
public bool PredictedMissesDeadline => PredictedEndDate > Deadline; public bool PredictedMissesDeadline => PredictedEndDate > Deadline;

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using Interaction; using Interaction;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization; using UnityEngine.Serialization;
using UnityEngine.UI; using UnityEngine.UI;
@ -38,11 +39,17 @@ public class UiController : MonoBehaviour
[SerializeField] private Gradient _deadlineTextColors; [SerializeField] private Gradient _deadlineTextColors;
public GameObject WinScreen;
public GameObject LoseScreen;
void Update() void Update()
{ {
UpdateActionDisplay(); UpdateActionDisplay();
UpdateProgressBar(); UpdateProgressBar();
UpdateDeadlineDateStuffTexts(); UpdateDeadlineDateStuffTexts();
WinScreen.SetActive(GameManager.Instance.Won);
LoseScreen.SetActive(GameManager.Instance.Lost);
} }
private void UpdateProgressBar() 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}"; _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}"; _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); _predictedEndText.color = _deadlineTextColors.Evaluate(TimeManager.Instance.PredictedMissesDeadline ? 0.0f : 1.0f);
} }
@ -97,4 +104,16 @@ public class UiController : MonoBehaviour
//_prevActionButton.interactable = _pickupper.CanSelectPrevious; //_prevActionButton.interactable = _pickupper.CanSelectPrevious;
//_nextActionButton.interactable = _pickupper.CanSelectNext; //_nextActionButton.interactable = _pickupper.CanSelectNext;
} }
public void Replay()
{
string currentSceneName = SceneManager.GetActiveScene().name;
SceneManager.LoadScene(currentSceneName);
}
public void Exit()
{
UnityEditor.EditorApplication.isPlaying = false;
Application.Quit();
}
} }

View File

@ -0,0 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Utility;
public class ToiletManager : MonoBehaviourSingleton<ToiletManager>
{
public bool IsOccupied;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 459a8de1571412a44927af6c9cc4ef5e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: