forked from Shardstone/trail-into-darkness
First commit on my server, yey!
This commit is contained in:
37
Assets/Code/Core/PlatformSelector.cs
Normal file
37
Assets/Code/Core/PlatformSelector.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Nox.Input;
|
||||
using Nox.Platform;
|
||||
|
||||
namespace Nox.Core {
|
||||
/// <summary>
|
||||
/// Base class used by the platform factory to select the current platform and the input
|
||||
/// </summary>
|
||||
public class PlatformSelector {
|
||||
public readonly DevicePlatform devicePlatform;
|
||||
private InputMode inputMode;
|
||||
|
||||
public PlatformSelector(DevicePlatform devicePlatform, InputMode inputMode) {
|
||||
this.devicePlatform = devicePlatform;
|
||||
this.inputMode = inputMode;
|
||||
}
|
||||
|
||||
public void SetInputMode(InputMode newInputMode) {
|
||||
inputMode = newInputMode;
|
||||
}
|
||||
|
||||
public static InputMode GetPlatformDefaultInputMode() {
|
||||
#if UNITY_EDITOR
|
||||
return InputMode.Editor;
|
||||
#else
|
||||
return InputMode.Desktop;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static DevicePlatform GetDevicePlatform() {
|
||||
#if UNITY_EDITOR
|
||||
return DevicePlatform.UnityEditor;
|
||||
#else
|
||||
return DevicePlatform.Desktop;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user