Add Alot of stuff, Computer, repairStation, Whole game, Many things!

This commit is contained in:
2024-11-18 06:31:28 +01:00
parent 19b7964f83
commit a2091c3cf2
430 changed files with 55285 additions and 715 deletions

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HUDManager : MonoBehaviour {
public static HUDManager Instance { get; private set; }
[SerializeField] private GameObject _computerHUD;
[SerializeField] private GameObject _sellScreenHUD;
private GameObject _currentHUD;
public bool isUiOpen => _currentHUD != null;
private void Awake() {
if (Instance != null) {
Debug.LogError("What? 2 HudManagers crazy!!!");
}
Instance = this;
}
private void Update() {
CheckClose();
}
public void ShowComputerHUD() {
ShowHUD(_computerHUD);
}
public void ShowSellScreenHUD(SellCounter counter) {
ShowHUD(_sellScreenHUD);
}
private void ShowHUD(GameObject hud) {
if (_currentHUD != null) {
_currentHUD.SetActive(false);
}
_currentHUD = hud;
_currentHUD.SetActive(true);
}
public void HideCurrentHUD() {
if (_currentHUD != null) {
_currentHUD.SetActive(false);
_currentHUD = null;
}
}
public void CheckClose() {
if (!Input.GetKeyDown(KeyCode.Escape)) return;
if (_currentHUD == null) return;
HideCurrentHUD();
}
//TODO: ask if its matters if i just return a SellSCreenBehaviour, or route them through the HUDManager
public void SellItem(SellCounter counter, Object sellingObject) {
Debug.Log(_sellScreenHUD.GetComponent<SellScreenController>());
this.ShowSellScreenHUD(counter);
_sellScreenHUD.GetComponent<SellScreenController>().SetItem(counter, sellingObject);
}
}