Платформер враги, инфраструктура, герой

This commit is contained in:
ThomasCharester committed 2026-03-09 16:28:40 +03:00
1 parent 28125eb382
commit 93819c1dd3
61 files changed
+1463 -423

No files matched your search

@@ -1,14 +1,13 @@
using System.Threading;
using Code.Debug;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Generators;
using Code.Infrastructure.UI;
using Code.Infrastructure.UI;
using Code.Infrastructure.UI.Panels;
namespace Code.Infrastructure.App.States
{
[State(typeof(AppStates),typeof(AppStateMachineContext))]
[StateRaisingEvent]
public partial class BootstrapState : IUIPanelLoaded, IReadyToPlayHandle
public partial class BootstrapState : IReadyToPlayHandle, IMenuChoosePanelCreatedHandle
{
private EventBus.EventBus _eventBus;
public BootstrapState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
@@ -23,7 +22,7 @@ namespace Code.Infrastructure.App.States
Context.UIService.TryRemovePanel(UIPanelType.Logo);
Context.UIService.TryLoadPanel(UIPanelType.DebugSceneChooser);
Context.UIService.TryLoadCreatePanel(UIPanelType.DebugSceneChooser);
Context.AudioFactory.LoadAudioClips(AudioNames.UISounds);
}
@@ -33,16 +32,16 @@ namespace Code.Infrastructure.App.States
Context.UIService.TryRemovePanel(UIPanelType.DebugSceneChooser);
_eventBus.Unsubscribe(this);
}
public void UILoaded(UIPanelType uiPanelType)
{
if (uiPanelType != UIPanelType.DebugSceneChooser) return;
Context.UIService.OpenPanel(uiPanelType);
}
public void OnReadyToPlay(AudioNames groupName)
{
Context.AudioService.PlayRepeatedly(AudioNames.UISounds,0);
}
public void MenuChoosePanelCreated(UIPanel panel)
{
panel.gameObject.SetActive(true);
panel.Open();
}
}
}
@@ -18,7 +18,7 @@ using Reflex.Core;
using Reflex.Injectors;
using Unity.Cinemachine;
using UnityEngine.SceneManagement;
// Ивенты создания панелей сломаны TODO
namespace Code.Infrastructure.App.States
{
[State(typeof(AppStates), typeof(AppStateMachineContext))]
@@ -27,7 +27,6 @@ namespace Code.Infrastructure.App.States
IOnGameplaySceneLoadedHandler,
IRaceGameHandle,
IRacerFactoryInitializedHandle,
IUIPanelLoaded,
ICinematicMachineHandle
{
public GameplayState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context, eventBus)
@@ -52,11 +51,11 @@ namespace Code.Infrastructure.App.States
// CinemachineCamera
_gameplayLoading = new Loading(7, GameplayLoadingCompleted);
Context.UIService.TryLoadPanel(UIPanelType.PlayerScoreCounter);
Context.UIService.TryLoadPanel(UIPanelType.WinScreen);
Context.UIService.TryLoadPanel(UIPanelType.PlayerScores);
Context.UIService.TryLoadCreatePanel(UIPanelType.PlayerScoreCounter);
Context.UIService.TryLoadCreatePanel(UIPanelType.WinScreen);
Context.UIService.TryLoadCreatePanel(UIPanelType.PlayerScores);
Context.SceneLoader.LoadSceneAsync(SceneId.Gameplay, LoadSceneMode.Single).Forget();
Context.InputService.EnableMap(ActionMappings.Gameplay);
Context.InputService.EnableMap(ActionMappings.Race);
Context.CameraFactory.LoadCinemachineCamera(CameraMode.ThirdPerson).Forget();
}
@@ -85,7 +84,7 @@ namespace Code.Infrastructure.App.States
Context.UIService.TryRemovePanel(UIPanelType.WinScreen);
Context.UIService.TryRemovePanel(UIPanelType.PlayerScores);
Context.CameraFactory.ReleaseCinemachineCamera(CameraMode.ThirdPerson);
Context.InputService.DisableMap(ActionMappings.Gameplay);
Context.InputService.DisableMap(ActionMappings.Race);
_raceGame = null;
@@ -120,7 +119,7 @@ namespace Code.Infrastructure.App.States
public void RaceGameEnded(RaceScores scores)
{
var winScreen = (WinScreen)Context.UIService.TryGetPanel(UIPanelType.WinScreen);
var winScreen = (WinScreen)Context.UIService.TryGetSinglePanel(UIPanelType.WinScreen);
var id = 0;
var cachedScores = scores.GetScores();
@@ -133,7 +132,7 @@ namespace Code.Infrastructure.App.States
var winText = $@"{id} МЕСТО\n";
winScreen.SetText(winText);
var getPanel = Context.UIService.TryGetPanel(UIPanelType.PlayerScores);
var getPanel = Context.UIService.TryGetSinglePanel(UIPanelType.PlayerScores);
((PlayerScores)getPanel)
.SetText(UNTILTHEYFIXCONTAINERS.Resolve<PlayerPrefsRacePoopshitter>().GetRaces());
Context.UIService.ClosePanel(UIPanelType.PlayerScoreCounter);
@@ -176,5 +175,14 @@ namespace Code.Infrastructure.App.States
}
public void CinemachineLoaded(CinemachineCamera cinemachineCamera) => _gameplayLoading.DoProgress();
public void UISinglePanelLoaded(UIPanelType uiPanelType)
{
}
public void UISinglePanelRemoved(UIPanelType uiPanelType)
{
throw new System.NotImplementedException();
}
}
}
@@ -12,7 +12,7 @@ namespace Code.Infrastructure.App.States
{
[State(typeof(AppStates),typeof(AppStateMachineContext))]
[StateRaisingEvent]
public partial class MainMenuState : IUIPanelLoaded, IReadyToPlayHandle, IOnMainMenuSceneLoadedHandler
public partial class MainMenuState : IReadyToPlayHandle, IOnMainMenuSceneLoadedHandler, IMenuChoosePanelCreatedHandle
{
public MainMenuState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
{
@@ -26,7 +26,7 @@ namespace Code.Infrastructure.App.States
_loading = new Loading(2, LoadComplete);
Context.UIService.TryLoadPanel(UIPanelType.DebugSceneChooser);
Context.UIService.TryLoadCreatePanel(UIPanelType.DebugSceneChooser);
// Context.AudioFactory.LoadAudioClips(AudioNames.UISounds);
Context.SceneLoader.LoadSceneAsync(SceneId.MainMenu, LoadSceneMode.Single).Forget();
Context.AudioService.PlayRepeatedly(AudioNames.UISounds,0);
@@ -39,14 +39,6 @@ namespace Code.Infrastructure.App.States
EventBus.Unsubscribe(this);
}
public void UILoaded(UIPanelType uiPanelType)
{
if (uiPanelType != UIPanelType.DebugSceneChooser) return;
Context.UIService.OpenPanel(uiPanelType);
_loading.DoProgress();
}
private void LoadComplete()
{
Context.UIService.OpenPanel(UIPanelType.DebugSceneChooser);
@@ -68,5 +60,13 @@ namespace Code.Infrastructure.App.States
{
}
public void MenuChoosePanelCreated(UIPanel panel)
{
panel.gameObject.SetActive(true);
panel.Open();
_loading.DoProgress();
}
}
}