A game about forced loneliness, made by TACStudios
1using System.ComponentModel;
2using UnityEngine.InputSystem.LowLevel;
3
4namespace UnityEngine.InputSystem.Processors
5{
6 [DesignTimeVisible(false)]
7 internal class CompensateDirectionProcessor : InputProcessor<Vector3>
8 {
9 public override Vector3 Process(Vector3 value, InputControl control)
10 {
11 if (!InputSystem.settings.compensateForScreenOrientation)
12 return value;
13
14 var rotation = Quaternion.identity;
15 switch (InputRuntime.s_Instance.screenOrientation)
16 {
17 case ScreenOrientation.PortraitUpsideDown: rotation = Quaternion.Euler(0, 0, 180); break;
18 case ScreenOrientation.LandscapeLeft: rotation = Quaternion.Euler(0, 0, 90); break;
19 case ScreenOrientation.LandscapeRight: rotation = Quaternion.Euler(0, 0, 270); break;
20 }
21 return rotation * value;
22 }
23
24 public override string ToString()
25 {
26 return "CompensateDirection()";
27 }
28
29 public override CachingPolicy cachingPolicy => CachingPolicy.EvaluateOnEveryRead;
30 }
31}