Экран смерти, смерть, бабки, Интерфейс, Шлюхи
This commit is contained in:
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
|
||||
{
|
||||
@@ -9,19 +11,31 @@ 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();
|
||||
}
|
||||
|
||||
public override void Tick()
|
||||
{ }
|
||||
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
|
||||
|
||||
@@ -16,4 +16,5 @@ MonoBehaviour:
|
||||
- {fileID: 3884205628991346111, guid: f23b9fce9594618e5b75845f1cae50de, type: 3}
|
||||
- {fileID: 6346323538546406952, guid: c566fc932edefbbee9e53271eac3c560, type: 3}
|
||||
- {fileID: 1153528220012302015, guid: 23e11d2c8a4f12f4ea9a7a43d1118464, type: 3}
|
||||
- {fileID: 1024894541486592765, guid: b2e8dc2aeb0311cd8a826b51cf8e94dc, type: 3}
|
||||
canvasPrefab: {fileID: 1289568913299077295, guid: 48aebfe8826dc0df79d047b5afbf8f5b, type: 3}
|
||||
@@ -0,0 +1,228 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7216240920911255732
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6611561882260570556}
|
||||
- component: {fileID: 3854552811963077917}
|
||||
- component: {fileID: 838910581382061681}
|
||||
m_Layer: 5
|
||||
m_Name: GameOverText
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6611561882260570556
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7216240920911255732}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2606207159731526013}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3854552811963077917
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7216240920911255732}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &838910581382061681
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7216240920911255732}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: GAMEOVER
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: a3ba170dcd95c5776a5c39de19dff119, type: 2}
|
||||
m_sharedMaterial: {fileID: 8532510215145708138, guid: a3ba170dcd95c5776a5c39de19dff119, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 360
|
||||
m_fontSizeBase: 360
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &8491848320201537683
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2606207159731526013}
|
||||
- component: {fileID: 2416919790455574494}
|
||||
- component: {fileID: 7415774796514587984}
|
||||
- component: {fileID: 1024894541486592765}
|
||||
m_Layer: 5
|
||||
m_Name: GameOver
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2606207159731526013
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8491848320201537683}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6611561882260570556}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2416919790455574494
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8491848320201537683}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7415774796514587984
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8491848320201537683}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.69411767}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &1024894541486592765
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8491848320201537683}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ecbe291069244405ac22e5470f3ba62b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Code.UI.GameOverPanel
|
||||
_background: {fileID: 7415774796514587984}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2e8dc2aeb0311cd8a826b51cf8e94dc
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user