dedicated
This commit is contained in:
@@ -4,13 +4,10 @@ namespace VeloX;
|
||||
|
||||
public class InputResolver
|
||||
{
|
||||
public Connection Driver { get; internal set; }
|
||||
|
||||
private bool IsDriverActive => Driver is not null;
|
||||
|
||||
public Vector2 MouseDelta => IsDriverActive ? Input.MouseDelta : default;
|
||||
public Vector2 MouseWheel => IsDriverActive ? Input.MouseWheel : default;
|
||||
public Angles AnalogLook => IsDriverActive ? Input.AnalogLook : default;
|
||||
public Vector2 MouseDelta => Input.MouseDelta;
|
||||
public Vector2 MouseWheel => Input.MouseWheel;
|
||||
public Angles AnalogLook => Input.AnalogLook;
|
||||
public Vector3 AnalogMove
|
||||
{
|
||||
get
|
||||
@@ -22,22 +19,19 @@ public class InputResolver
|
||||
input.y = -Input.GetAnalog( InputAnalog.LeftStickX );
|
||||
return input;
|
||||
}
|
||||
return IsDriverActive ? Input.AnalogMove : default;
|
||||
return Input.AnalogMove;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Down( string action )
|
||||
{
|
||||
return IsDriverActive && Input.Down( action );
|
||||
return Input.Down( action );
|
||||
}
|
||||
|
||||
public float Brake
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !IsDriverActive )
|
||||
return 0;
|
||||
|
||||
if ( Input.UsingController )
|
||||
return Input.GetAnalog( InputAnalog.LeftTrigger );
|
||||
|
||||
@@ -48,9 +42,6 @@ public class InputResolver
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( !IsDriverActive )
|
||||
return 0;
|
||||
|
||||
if ( Input.UsingController )
|
||||
return Input.GetAnalog( InputAnalog.RightTrigger );
|
||||
|
||||
@@ -60,37 +51,30 @@ public class InputResolver
|
||||
|
||||
public bool Pressed( string action )
|
||||
{
|
||||
return IsDriverActive && Input.Pressed( action );
|
||||
return Input.Pressed( action );
|
||||
}
|
||||
|
||||
public bool Released( string action )
|
||||
{
|
||||
return IsDriverActive && Input.Released( action );
|
||||
return Input.Released( action );
|
||||
}
|
||||
|
||||
public float GetAnalog( InputAnalog analog )
|
||||
{
|
||||
return IsDriverActive ? Input.GetAnalog( analog ) : 0f;
|
||||
return Input.GetAnalog( analog );
|
||||
}
|
||||
|
||||
public void TriggerHaptics( float leftMotor, float rightMotor, float leftTrigger = 0f, float rightTrigger = 0f, int duration = 500 )
|
||||
{
|
||||
if ( IsDriverActive )
|
||||
{
|
||||
Input.TriggerHaptics( leftMotor, rightMotor, leftTrigger, rightTrigger, duration );
|
||||
}
|
||||
Input.TriggerHaptics( leftMotor, rightMotor, leftTrigger, rightTrigger, duration );
|
||||
}
|
||||
public void TriggerHaptics( HapticEffect effect, float lengthScale = 1, float frequencyScale = 1, float amplitudeScale = 1 )
|
||||
{
|
||||
if ( IsDriverActive )
|
||||
{
|
||||
Input.TriggerHaptics( effect, lengthScale, frequencyScale, amplitudeScale );
|
||||
}
|
||||
Input.TriggerHaptics( effect, lengthScale, frequencyScale, amplitudeScale );
|
||||
}
|
||||
|
||||
public void StopAllHaptics()
|
||||
{
|
||||
if ( IsDriverActive )
|
||||
Input.StopAllHaptics();
|
||||
Input.StopAllHaptics();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user