Add force feedback toggle in settings

This commit is contained in:
2021-04-24 14:34:15 +02:00
parent 83fad3de39
commit c718071582
18 changed files with 64 additions and 14 deletions
+7 -2
View File
@@ -23,6 +23,7 @@ namespace EvilSatellites
public bool IsPlaying;
public Vector3 RadarTarget;
public Matrix RadarOrientation;
public Radar(IGameObject owner, IScreen screen)
{
Owner = owner;
@@ -91,7 +92,10 @@ namespace EvilSatellites
}
} else
{
if (objects.Count < 1) return;
if (objects.Count < 1)
{
RadarNoise.Volume = 0f;
}
float minDistance = 50000000;
Target = null;
foreach (var obj in objects)
@@ -106,7 +110,7 @@ namespace EvilSatellites
}
if (Target == null)
{
// RadarNoise.Pitch = 0.1;
RadarNoise.Volume = 0f;
return;
}
Vector3 radarTarget = (Target.Position - Owner.Position);
@@ -116,6 +120,7 @@ namespace EvilSatellites
RadarDirection = new Vector3(radarTarget.X*0.5f, radarTarget.Y*0.5f, radarTarget.Z*0.5f);
RadarOrientation = Matrix.Invert(Matrix.CreateTranslation(Target.Position) * Matrix.CreateLookAt(Target.Position, Owner.Position, Owner.Rotation.Up));
RadarNoise.Reset();
RadarNoise.Volume = 1f;
// RadarNoise.Play();
IsPlaying = true;
// RadarNoise.Pitch = MathHelper.Clamp(0.1f / Vector3.Distance(Owner.Rotation.Forward, radarTarget) * 3f, 0, 1);