refactor playermovement

This commit is contained in:
2023-05-01 19:43:58 +03:00
parent f5f0af31a2
commit 14b4426d04
5 changed files with 252 additions and 212 deletions

View File

@@ -17,11 +17,19 @@ namespace Game
#endif
}
private readonly InputEvent onExit = new InputEvent("Exit");
public override void Initialize()
{
//FlaxEngine.Debug.Log("ConsolePlugin initialized");
Console.Init();
onExit.Triggered += () =>
{
if (Console.IsSafeToQuit)
Engine.RequestExit();
};
//AssetManager.Init(); // TODO: move these elsewhere
#if !FLAX_EDITOR
Level.SceneLoading += OnSceneLoading;
@@ -31,6 +39,7 @@ namespace Game
public override void Deinitialize()
{
onExit.Dispose();
#if !FLAX_EDITOR
Level.SceneLoading -= OnSceneLoading;
Level.SceneLoaded -= OnSceneLoaded;
@@ -86,11 +95,19 @@ namespace Game
_description = DescriptionInternal;
}
//private readonly InputEvent onExit = new InputEvent("Exit");
public override void Initialize()
{
//FlaxEngine.Debug.Log("ConsolePlugin initialized");
Console.Init();
/*onExit.Triggered += () =>
{
if (Console.IsSafeToQuit)
Engine.RequestExit();
};*/
//AssetManager.Init();
Level.SceneLoading += OnSceneLoading;
@@ -112,6 +129,8 @@ namespace Game
FlaxEditor.Editor.Instance.PlayModeEnd -= OnPlayModeEnd;
}*/
private void OnPlayModeBegin()
{
//FlaxEditor.Editor.Instance.PlayModeBegin -= Instance_PlayModeBegin;
@@ -124,12 +143,14 @@ namespace Game
private void OnPlayModeEnd()
{
//onExit.Dispose();
//GameMode.StopServer();
NetworkManager.Cleanup();
}
public override void Deinitialize()
{
//onExit.Dispose();
//Level.SceneLoaded -= OnSceneLoaded;
Level.SceneLoading -= OnSceneLoading;
if (FlaxEditor.Editor.Instance != null)