Соединение всё со всем что имеется, дописывание стейт-машины
Теперь мне удобно кастить и получать тип камеры, всё вроде работает нормисно
This commit is contained in:
1 parent
4549617275
commit
665114b7dc
28 files changed
+292
-598
No files matched your search
@@ -1,16 +1,13 @@
|
||||
using Code.App.StateMachine;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Gameplay.Player;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StateMachine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.App.AppStates
|
||||
{
|
||||
public class GameplayState : BaseState<AppStateMachineContext>
|
||||
{
|
||||
private PlayerHealth _playerHealthPoints;
|
||||
|
||||
public GameplayState(AppStateMachineContext context) : base(context)
|
||||
{
|
||||
@@ -21,9 +18,6 @@ namespace Code.App.AppStates
|
||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
|
||||
Context.UIService.LoadingScreen.Show();
|
||||
Context.UIService.SwitchPanelTo(UIPanel.Gameplay);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,17 +16,11 @@ namespace Code.App.AppStates
|
||||
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);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.Static);
|
||||
}
|
||||
|
||||
private void SceneLoaded()
|
||||
{
|
||||
Context.UIService.LoadingScreen.Hide();
|
||||
|
||||
base.EnterState();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Code.App.StateMachine;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StateMachine;
|
||||
@@ -16,6 +17,8 @@ namespace Code.App.AppStates
|
||||
{
|
||||
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
|
||||
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
|
||||
}
|
||||
|
||||
private void SceneLoaded()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Code.App.StateMachine;
|
||||
using Code.Configs;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Gameplay.Character.Camera;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StaticData;
|
||||
@@ -22,7 +21,6 @@ namespace Code.App
|
||||
InstallInfrastructureUnit(containerBuilder, staticDataService);
|
||||
|
||||
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
||||
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
|
||||
|
||||
InitializeCamera(containerBuilder, staticDataService);
|
||||
|
||||
@@ -37,7 +35,7 @@ namespace Code.App
|
||||
// containerBuilder.AddSingleton(cameraService);
|
||||
// DontDestroyOnLoad(cameraService);
|
||||
|
||||
Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab2);
|
||||
Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab);
|
||||
DontDestroyOnLoad(camera);
|
||||
containerBuilder.AddSingleton(camera);
|
||||
}
|
||||
@@ -61,9 +59,7 @@ namespace Code.App
|
||||
|
||||
containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService));
|
||||
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
|
||||
containerBuilder.AddSingleton(staticDataService.UIConfig.canvasPrefab, typeof(Canvas));
|
||||
containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.UIConfig.uiElementsPrefabs, typeof(UIElement[]));
|
||||
}
|
||||
|
||||
private void Bootstrap(Container container)
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Code.App.StateMachine
|
||||
{
|
||||
[Inject] public ISceneLoaderService SceneLoaderService;
|
||||
[Inject] public IInputService InputService;
|
||||
[Inject] public IUIService UIService;
|
||||
[Inject] public AppStateMachine StateMachine;
|
||||
[Inject] public CameraStateMachine CameraStateMachine;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user