Add force feedback toggle in settings
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>d:\EvilSatellites\</OutputPath>
|
||||
<OutputPath></OutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Icon.ico" />
|
||||
|
||||
@@ -9,6 +9,6 @@ namespace EvilSatellites
|
||||
public static class GameSettings
|
||||
{
|
||||
public static bool PreferSAPI = true;
|
||||
|
||||
public static bool UseForceFeedback = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace EvilSatellites
|
||||
public static int DebrisCollected;
|
||||
public static int SatelliteCollisions;
|
||||
public static int DebrisCollisions;
|
||||
public static int Wave;
|
||||
public static double TotalPlayTime;
|
||||
public static void Reset()
|
||||
{
|
||||
@@ -22,7 +23,7 @@ namespace EvilSatellites
|
||||
SatelliteCollisions = 0;
|
||||
DebrisCollisions = 0;
|
||||
TotalPlayTime = 0;
|
||||
|
||||
Wave = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace EvilSatellites
|
||||
public GameScreen Screen;
|
||||
private Random rnd = new Random();
|
||||
private int Level;
|
||||
private double RespawnTimer;
|
||||
private bool IsRespawning;
|
||||
public SatelliteSpawner(GameScreen screen)
|
||||
{
|
||||
Screen = screen;
|
||||
@@ -32,15 +34,28 @@ namespace EvilSatellites
|
||||
var sat = new Satellite(Screen, new Vector3(x, y, z));
|
||||
Screen.AddObject(sat);
|
||||
}
|
||||
Screen.Manager.Sound.PlayOneshot(@"sfx/ui/enemiesDetected.wav");
|
||||
IsRespawning = false;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
public void Update(GameTime time)
|
||||
{
|
||||
var sats = Screen.Objects.Where((x) => x.Type == ObjectType.Satellite).ToList();
|
||||
if (sats.Count < 1)
|
||||
if (sats.Count < 1 && IsRespawning == false)
|
||||
{
|
||||
Level++;
|
||||
Spawn();
|
||||
IsRespawning = true;
|
||||
RespawnTimer = 0;
|
||||
}
|
||||
if (IsRespawning)
|
||||
{
|
||||
RespawnTimer += time.ElapsedGameTime.TotalMilliseconds;
|
||||
if (RespawnTimer > 5000)
|
||||
{
|
||||
GameStats.Wave++;
|
||||
Level++;
|
||||
Spawn();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace EvilSatellites.Screens
|
||||
}
|
||||
UpdateRadar();
|
||||
CheckCollisions();
|
||||
Spawner.Update();
|
||||
Spawner.Update(gameTime);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace EvilSatellites.Screens
|
||||
MenuOptions = new MenuContainer("Options", "Set global options for the game.");
|
||||
MenuOptions.Add(new MenuEntry("Music Volume", "Toggle between music volumes"))
|
||||
.Add(new MenuEntry("Use screen reader", "Use screen reader speech instead of SAPI"))
|
||||
.Add(new MenuEntry("Use Force Feedback", "Vibrate on certain game actions such as weapon fire, getting hit, etc."))
|
||||
.Add(new MenuEntry("Back", "Go Back to previous screen"));
|
||||
base.Activate();
|
||||
}
|
||||
@@ -31,6 +32,10 @@ namespace EvilSatellites.Screens
|
||||
ChangeSpeech();
|
||||
}
|
||||
if (CursorPosition == 2)
|
||||
{
|
||||
ChangeForceFeedback();
|
||||
}
|
||||
if (CursorPosition == 3)
|
||||
{
|
||||
Manager.RemoveScreen(this);
|
||||
Manager.AddScreen(new MainMenuScreen());
|
||||
@@ -73,5 +78,20 @@ namespace EvilSatellites.Screens
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ChangeForceFeedback()
|
||||
{
|
||||
if (GameSettings.UseForceFeedback)
|
||||
{
|
||||
GameSettings.UseForceFeedback = false;
|
||||
Tolk.Output("Disabled force feedback");
|
||||
}
|
||||
else
|
||||
{
|
||||
GameSettings.UseForceFeedback = true;
|
||||
Tolk.Output("Enabled force feedback");
|
||||
Manager.Vibrations.AddVibration(1, 1, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace EvilSatellites.Screens
|
||||
.Add(new MenuEntry("Satellites shot: " + GameStats.SatellitesShot.ToString(), "Amount of satellites shot during this game."))
|
||||
.Add(new MenuEntry("Debris collected: " + GameStats.DebrisCollected.ToString(), "Amount of debris collected during this game."))
|
||||
.Add(new MenuEntry("Satellite collisions: " + GameStats.SatelliteCollisions.ToString(), "How many satellites you crashed into"))
|
||||
.Add(new MenuEntry("Wave: " + GameStats.Wave.ToString(), "The wave you died on."))
|
||||
.Add(new MenuEntry("Total play time: " + TimeSpan.FromSeconds(GameStats.TotalPlayTime).ToString(), "How much time you spent on this run"))
|
||||
.Add(new MenuEntry("OK", "Go back to main menu"));
|
||||
base.Activate();
|
||||
|
||||
@@ -20,11 +20,16 @@ namespace EvilSatellites
|
||||
|
||||
public void AddVibration(float leftMotor, float rightMotor, float durationMS)
|
||||
{
|
||||
vibrations.Add(new Vibration(leftMotor, rightMotor, durationMS));
|
||||
if (GameSettings.UseForceFeedback)
|
||||
{
|
||||
vibrations.Add(new Vibration(leftMotor, rightMotor, durationMS));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Update(float msElapsed)
|
||||
{
|
||||
if (!GameSettings.UseForceFeedback) return;
|
||||
List<Vibration> toDelete = new List<Vibration>();
|
||||
|
||||
foreach (Vibration vibration in vibrations)
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace EvilSatellites.Weapons
|
||||
if (RemainingAmmo > 0)
|
||||
{
|
||||
sfxShoot.Play();
|
||||
Screen.Manager.Vibrations.AddVibration(1, 1, 100);
|
||||
Screen.Manager.Vibrations.AddVibration(1, 1, 70);
|
||||
RemainingAmmo--;
|
||||
TimerStart = TimerEnd;
|
||||
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation, _wielder);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5b793fb1ac73870eea5242d89e85373359b8ce13cec7f541affaad2c53f71046
|
||||
size 126764
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f7e1fcdc804e2ea60f61554ee6147d54f87a5da5da21b232f4c5142413e4ff5d
|
||||
size 332210
|
||||
oid sha256:4f94a1e2d76335c9f6a741f8713d6c9be832705c231a23775c6e4292a70b596e
|
||||
size 311668
|
||||
|
||||
Reference in New Issue
Block a user