Экран смерти, смерть, бабки, Интерфейс, Шлюхи

This commit is contained in:
ThomasCharester committed 2025-11-01 01:45:46 +03:00
1 parent edf3821c0d
commit 019da8cfd3
16 files changed
+278 -60

No files matched your search

@@ -1,6 +1,8 @@
using Code.App.StateMachine;
using Code.Scenes;
using Code.StateMachine;
using Code.UI;
using UnityEngine;
namespace Code.App.AppStates
{
@@ -8,20 +10,32 @@ namespace Code.App.AppStates
{
public GameOverState(AppStateMachineContext context) : base(context)
{ }
private float damnTimer = 3f;
public override void EnterState()
{
Context.UIService.LoadingScreen.Show();
Context.UIService.SwitchPanelTo(UIPanel.GameOver);
base.EnterState();
}
private void ToMainMenu()
{
Context.StateMachine.SwitchState(AppState.MainMenu)
.AllowStateTransition(AppState.Gameplay);
}
public override void Tick()
{ }
{
damnTimer -= Time.deltaTime;
if (damnTimer <= float.Epsilon) ToMainMenu();
}
public override void ExitState()
{
damnTimer = 5f;
Context.UIService.LoadingScreen.Show();
base.ExitState();
}
}
@@ -52,16 +52,12 @@ namespace Code.App.AppStates
// Debug
private void GiveHealth(InputAction.CallbackContext context)
{
UnityEngine.Debug.Log("Giving health");
_playerHealth.GetDamage(-1);
UnityEngine.Debug.Log(_playerHealth.HealthPoints);
}
private void LooseHealth(InputAction.CallbackContext context)
{
UnityEngine.Debug.Log("Losing health");
_playerHealth.GetDamage(1);
UnityEngine.Debug.Log(_playerHealth.HealthPoints);
}
private void GiveMoney(InputAction.CallbackContext context)
@@ -80,7 +76,8 @@ namespace Code.App.AppStates
private void EndGame()
{
Context.StateMachine.SwitchState(AppState.GameOver);
Context.StateMachine.SwitchState(AppState.GameOver)
.AllowStateTransition(AppState.MainMenu);
}
public override void ExitState()
@@ -20,10 +20,10 @@ namespace Code.App.AppStates
public override void EnterState()
{
Context.UIService.LoadingScreen.Show();
Context.SceneLoaderService.LoadScene((int)SceneIds.MainMenu, SceneLoaded);
Context.InputService.EnableMap(ActionMappings.MainMenu);
Context.UIService.LoadingScreen.Show();
Context.UIService.SwitchPanelTo(UIPanel.MainMenu);
((MainMenuPanel)Context.UIService.CurrentPanel).startButton.onClick.AddListener(StartGame);
((MainMenuPanel)Context.UIService.CurrentPanel).exitButton.onClick.AddListener(ExitGame);
@@ -1,5 +1,4 @@
using Code.UI;
using Code.UI.GameplayElements;
using UnityEngine;
using UnityEngine.Serialization;
@@ -10,10 +9,5 @@ namespace Code.Configs
{
[FormerlySerializedAs("uiElements")] public UIElement[] uiElementsPrefabs;
[FormerlySerializedAs("canvas")] public Canvas canvasPrefab;
[Header("GameplayPanel")]
public HealthBar healthBarPrefab;
public MoneyBar moneyBarPrefab;
}
}
@@ -0,0 +1,19 @@
using UnityEngine;
using UnityEngine.UI;
namespace Code.UI
{
public class GameOverPanel : UIElement
{
[SerializeField] private Image _background;
public void Hide()
{
_background.enabled = false;
}
public void Show()
{
_background.enabled = true;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ecbe291069244405ac22e5470f3ba62b
timeCreated: 1761948692
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 271d8609b0d94575a2e61c48d3b46d63
timeCreated: 1761917025
@@ -1,18 +0,0 @@
using Code.Gameplay.Player;
using UnityEngine;
using UnityEngine.UI;
namespace Code.UI.GameplayElements
{
public class HealthBar : MonoBehaviour
{
[SerializeField] private Image healthBar;
public void HealthUpdate(int count, PlayerHealth health)
{
// TODO Анимация потери
float fillAmount = (float)health.HealthPoints / health.MaxHealthPoints;
healthBar.fillAmount = fillAmount;
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: ddb267271c834c6697caff23709d30a2
timeCreated: 1761917038
@@ -1,16 +0,0 @@
using TMPro;
using UnityEngine;
namespace Code.UI.GameplayElements
{
public class MoneyBar : MonoBehaviour
{
[SerializeField] private TMP_Text moneyText;
public void MoneyUpdate(int count, int money)
{
// TODO Анимация получения\потери
moneyText.text = money.ToString();
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 02373b82fefd4812ac1d6d97d65fc9f0
timeCreated: 1761917491
@@ -1,5 +1,4 @@
using Code.Gameplay.Player;
using Code.UI.GameplayElements;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@@ -1,4 +1,3 @@
using Code.UI.GameplayElements;
using UnityEngine;
namespace Code.UI