forked from Shardstone/trail-into-darkness
First commit on my server, yey!
This commit is contained in:
35
Assets/Code/Platform/DesktopPlatform.cs
Normal file
35
Assets/Code/Platform/DesktopPlatform.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
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() { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user