Files
trail-into-darkness/Assets/Code/Platform/DesktopPlatform.cs
2026-03-19 18:12:07 +01:00

36 lines
1.2 KiB
C#

using Nox.Input;
using System.Collections;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Nox.Platform {
public class DesktopPlatform : IPlatform {
private readonly AssetReference assetReference;
private DesktopPlatformSettings desktopPlatformSettings;
public DesktopPlatform(AssetReference assetReference) {
this.assetReference = assetReference;
}
public PlatformSettings PlatformSettings => desktopPlatformSettings;
public IEnumerator Initialize(object applicationData) {
var handle = Addressables.LoadAssetAsync<DesktopPlatformSettings>(assetReference);
yield return new WaitUntil(() => handle.IsDone);
desktopPlatformSettings = handle.Result;
Debug.Log($"Device Platform {desktopPlatformSettings.devicePlatform} initialized");
InitializeInput();
}
public IInput InitializeInput() {
var inputHandler = new DesktopInput(desktopPlatformSettings);
inputHandler.Initialize();
return inputHandler;
}
public void Tick() { }
public void Dispose() { }
public void OnApplicationQuit() { }
}
}