Essentials + extra crap
Loadings Startups Movement Camera
This commit is contained in:
1 parent
662f4a1d05
commit
5f5ace1b52
734 files changed
+107323
-1713
No files matched your search
@@ -0,0 +1,25 @@
|
||||
using Code.Infrastructure.Camera;
|
||||
using Reflex.Attributes;
|
||||
|
||||
namespace Code.Infrastructure.App
|
||||
{
|
||||
public enum AppStates
|
||||
{
|
||||
Bootstrap,
|
||||
Gameplay,
|
||||
MainMenu
|
||||
}
|
||||
|
||||
public class AppStateMachineContext
|
||||
{
|
||||
[Inject] public SceneLoader.SceneLoader SceneLoader { get; set; }
|
||||
[Inject] public CameraStateMachine Camera { get; set; }
|
||||
}
|
||||
|
||||
[Generators.StateMachine(typeof(AppStateMachineContext),typeof(AppStates))]
|
||||
public partial class AppStateMachine
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5627248405434f028be921cb7916f823
|
||||
timeCreated: 1765572329
|
||||
@@ -0,0 +1,69 @@
|
||||
using Code.Infrastructure.Camera;
|
||||
using Code.Infrastructure.Configs;
|
||||
using Code.Infrastructure.Input;
|
||||
using Code.Infrastructure.Loadings;
|
||||
using Code.Infrastructure.SceneLoader;
|
||||
using Reflex.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Infrastructure.App
|
||||
{
|
||||
public class PapaInstaller : MonoBehaviour, IInstaller, ISceneConfigsLoadedHandle, IInputServiceInitializedHandle, ICameraInitializedHandle
|
||||
{
|
||||
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||
{
|
||||
containerBuilder.AddSingleton(typeof(EventBus.EventBus));
|
||||
containerBuilder.AddSingleton(typeof(ConfigLocator), typeof(IConfigLocator));
|
||||
containerBuilder.AddSingleton(typeof(SceneLoader.SceneLoader));
|
||||
containerBuilder.AddSingleton(typeof(InputService),typeof(IInputService));
|
||||
|
||||
containerBuilder.OnContainerBuilt += Bootstrap;
|
||||
|
||||
containerBuilder.AddSingleton(typeof(AppStateMachine));
|
||||
containerBuilder.AddSingleton(typeof(AppStateMachineContext));
|
||||
|
||||
containerBuilder.AddSingleton(typeof(CameraFactory));
|
||||
containerBuilder.AddSingleton(typeof(CameraStateMachine));
|
||||
containerBuilder.AddSingleton(typeof(CameraStateMachineContext));
|
||||
|
||||
}
|
||||
|
||||
private Loading initialLoading;
|
||||
private Container _thatRightContainer;
|
||||
private void Bootstrap(Container container)
|
||||
{
|
||||
_thatRightContainer = container;
|
||||
|
||||
container.Resolve<EventBus.EventBus>().Subscribe(this);
|
||||
container.Resolve<SceneLoader.SceneLoader>();
|
||||
container.Resolve<IInputService>();
|
||||
container.Resolve<CameraFactory>().CreateCameraStateMachine(container.Resolve<CameraStateMachine>()).Forget();
|
||||
|
||||
initialLoading = new Loading(3, () => EssentialLoadEnded(container));
|
||||
}
|
||||
|
||||
private void EssentialLoadEnded(Container container)
|
||||
{
|
||||
container.Resolve<AppStateMachine>().SwitchState(AppStates.Bootstrap).AllowStateTransition(AppStates.Gameplay);
|
||||
container.Resolve<EventBus.EventBus>().Unsubscribe(this);
|
||||
}
|
||||
|
||||
public void SceneConfigsLoaded()
|
||||
{
|
||||
initialLoading.DoProgress();
|
||||
}
|
||||
|
||||
public void InputServiceInitialized()
|
||||
{
|
||||
initialLoading.DoProgress();
|
||||
}
|
||||
|
||||
public void CameraInitialized(CameraStateMachineContext.CameraLoadedData data)
|
||||
{
|
||||
_thatRightContainer.Resolve<CameraStateMachineContext>().cameraLoadedData = data;
|
||||
_thatRightContainer.Resolve<CameraStateMachine>().SwitchState(CameraMode.None)
|
||||
.AllowStateTransition(CameraMode.FirstPerson);
|
||||
initialLoading.DoProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e62d9c9e01334727887a684e008440a6
|
||||
timeCreated: 1765572590
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30a683bd88f74628b64f7e17315b0c5d
|
||||
timeCreated: 1766393607
|
||||
@@ -0,0 +1,19 @@
|
||||
using Reflex.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Infrastructure.App.SceneInstallers
|
||||
{
|
||||
public class GameplaySceneInstaller : MonoBehaviour, IInstaller
|
||||
{
|
||||
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||
{
|
||||
|
||||
containerBuilder.OnContainerBuilt += PostInstall;
|
||||
}
|
||||
|
||||
private void PostInstall(Container container)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab7d8da1f0cc44bf99ae978a6b75847a
|
||||
timeCreated: 1768127778
|
||||
@@ -0,0 +1,20 @@
|
||||
using Code.Example;
|
||||
using Reflex.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Infrastructure.App.SceneInstallers
|
||||
{
|
||||
public class MainMenuSceneInstaller : MonoBehaviour, IInstaller
|
||||
{
|
||||
public void InstallBindings(ContainerBuilder containerBuilder)
|
||||
{
|
||||
|
||||
containerBuilder.OnContainerBuilt += PostInstall;
|
||||
}
|
||||
|
||||
private void PostInstall(Container container)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 067978788f51445ca3af5381eafec386
|
||||
timeCreated: 1766393632
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 778cb4118a914d9c8b1cac8bef4295a5
|
||||
timeCreated: 1765572459
|
||||
@@ -0,0 +1,38 @@
|
||||
using Code.Infrastructure.Camera;
|
||||
using Code.Infrastructure.Generators;
|
||||
using Code.Infrastructure.SceneLoader;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Code.Infrastructure.App.States
|
||||
{
|
||||
[State(typeof(AppStates),typeof(AppStateMachineContext))]
|
||||
[StateRaisingEvent]
|
||||
public partial class BootstrapState : IOnGameplaySceneLoadedHandler
|
||||
{
|
||||
private EventBus.EventBus _eventBus;
|
||||
public BootstrapState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
|
||||
{
|
||||
_eventBus = eventBus;
|
||||
}
|
||||
|
||||
public override AppStates myState => AppStates.Bootstrap;
|
||||
protected override void OnEnterState()
|
||||
{
|
||||
_eventBus.Subscribe(this);
|
||||
Context.Camera.SwitchState(CameraMode.FirstPerson).AllowStateTransition(CameraMode.None);
|
||||
Context.SceneLoader.LoadSceneAsync(SceneId.Gameplay, LoadSceneMode.Single).Forget();
|
||||
}
|
||||
|
||||
protected override void OnExitState()
|
||||
{
|
||||
_eventBus.Unsubscribe(this);
|
||||
}
|
||||
|
||||
public void OnGameplaySceneLoaded()
|
||||
{
|
||||
Debug.Log("Spermageddon");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71df5370ea2e4819bfbdb9cbb8e6c0ab
|
||||
timeCreated: 1765572469
|
||||
@@ -0,0 +1,31 @@
|
||||
using Code.Infrastructure.Camera;
|
||||
using Code.Infrastructure.Generators;
|
||||
using Code.Infrastructure.SceneLoader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Infrastructure.App.States
|
||||
{
|
||||
[State(typeof(AppStates),typeof(AppStateMachineContext))]
|
||||
[StateRaisingEvent]
|
||||
public partial class GameplayState : IOnGameplaySceneLoadedHandler
|
||||
{
|
||||
public GameplayState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context, eventBus)
|
||||
{
|
||||
}
|
||||
|
||||
public override AppStates myState => AppStates.Gameplay;
|
||||
protected override void OnEnterState()
|
||||
{
|
||||
Context.Camera.SwitchState(CameraMode.FirstPerson).AllowStateTransition(CameraMode.None);
|
||||
}
|
||||
|
||||
protected override void OnExitState()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnGameplaySceneLoaded()
|
||||
{
|
||||
Debug.Log("Spermageddon");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e543193800134f7b858502743ab3a43d
|
||||
timeCreated: 1766436900
|
||||
@@ -0,0 +1,22 @@
|
||||
using Code.Infrastructure.Generators;
|
||||
|
||||
namespace Code.Infrastructure.App.States
|
||||
{
|
||||
[State(typeof(AppStates),typeof(AppStateMachineContext))]
|
||||
[StateRaisingEvent]
|
||||
public partial class MainMenuState
|
||||
{
|
||||
public MainMenuState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
|
||||
{
|
||||
}
|
||||
|
||||
public override AppStates myState => AppStates.MainMenu;
|
||||
protected override void OnEnterState()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnExitState()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a17221ff27a400e80c42a2ea60bb4ee
|
||||
timeCreated: 1766436796
|
||||
Reference in new issue
Block a user