Platformer example started

This commit is contained in:
ThomasCharester committed 2026-02-22 13:59:04 +03:00
1 parent efcfaae647
commit 9f026b76d6
325 files changed
+23540 -270

No files matched your search

@@ -48,11 +48,13 @@ namespace Code.Infrastructure.App.States
// Factory
// PlayerCounter
// WinScreen
// ScoreScreen
// CinemachineCamera
_gameplayLoading = new Loading(6, GameplayLoadingCompleted);
_gameplayLoading = new Loading(7, GameplayLoadingCompleted);
Context.UIService.TryLoadPanel(UIPanelType.PlayerScoreCounter);
Context.UIService.TryLoadPanel(UIPanelType.WinScreen);
Context.UIService.TryLoadPanel(UIPanelType.PlayerScores);
Context.SceneLoader.LoadSceneAsync(SceneId.Gameplay, LoadSceneMode.Single).Forget();
Context.InputService.EnableMap(ActionMappings.Gameplay);
Context.CameraFactory.LoadCinemachineCamera(CameraMode.ThirdPerson).Forget();
@@ -73,14 +75,15 @@ namespace Code.Infrastructure.App.States
_raceGame.PlacedRacers[0].gameObject.transform;
Context.UIService.ClosePanel(UIPanelType.Loading);
_raceGame.StartRacers();
}
protected override void OnExitState()
{
Context.InputService.DisableMap(ActionMappings.Gameplay);
{
Context.UIService.TryRemovePanel(UIPanelType.PlayerScoreCounter);
Context.UIService.TryRemovePanel(UIPanelType.WinScreen);
Context.UIService.TryRemovePanel(UIPanelType.PlayerScores);
Context.CameraFactory.ReleaseCinemachineCamera(CameraMode.ThirdPerson);
Context.InputService.DisableMap(ActionMappings.Gameplay);
@@ -125,9 +128,14 @@ namespace Code.Infrastructure.App.States
for (var i = 0; i < cachedScores.Count; i++)
if (cachedScores[i].Key.Data.type == RacerType.Player) id = i + 1;
UNTILTHEYFIXCONTAINERS.Resolve<PlayerPrefsRacePoopshitter>().AddRace(new(_raceGame.RaceTime, id));
var winText = $@"{id} МЕСТО\n";
winScreen.SetText(winText);
var getPanel = Context.UIService.TryGetPanel(UIPanelType.PlayerScores);
((PlayerScores)getPanel)
.SetText(UNTILTHEYFIXCONTAINERS.Resolve<PlayerPrefsRacePoopshitter>().GetRaces());
Context.UIService.ClosePanel(UIPanelType.PlayerScoreCounter);
Context.UIService.OpenPanel(UIPanelType.WinScreen);
@@ -137,7 +145,11 @@ namespace Code.Infrastructure.App.States
private async UniTaskVoid EndTheGame()
{
await UniTask.WaitForSeconds(3f);
Context.UIService.ClosePanel(UIPanelType.WinScreen);
Context.UIService.OpenPanel(UIPanelType.PlayerScores);
await UniTask.WaitForSeconds(5f);
Context.UIService.OpenPanel(UIPanelType.Loading);
Context.StateMachine.SwitchState(AppStates.MainMenu).AllowStateTransition(AppStates.Gameplay);
}
@@ -151,7 +163,7 @@ namespace Code.Infrastructure.App.States
public void UILoaded(UIPanelType uiPanelType)
{
if(uiPanelType == UIPanelType.WinScreen)
if(uiPanelType is UIPanelType.WinScreen or UIPanelType.PlayerScores)
{
_gameplayLoading.DoProgress();
return;
@@ -13,18 +13,16 @@ namespace Code.Infrastructure.App.States
[State(typeof(AppStates),typeof(AppStateMachineContext))]
[StateRaisingEvent]
public partial class MainMenuState : IUIPanelLoaded, IReadyToPlayHandle, IOnMainMenuSceneLoadedHandler
{
private EventBus.EventBus _eventBus;
{
public MainMenuState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
{
_eventBus = eventBus;
{
}
public override AppStates myState => AppStates.MainMenu;
private Loading _loading;
protected override void OnEnterState()
{
_eventBus.Subscribe(this);
EventBus.Subscribe(this);
_loading = new Loading(2, LoadComplete);
@@ -38,7 +36,7 @@ namespace Code.Infrastructure.App.States
{
// Context.AudioFactory.ReleaseAudios(AudioNames.UISounds);
Context.UIService.TryRemovePanel(UIPanelType.DebugSceneChooser);
_eventBus.Unsubscribe(this);
EventBus.Unsubscribe(this);
}
public void UILoaded(UIPanelType uiPanelType)