Basic gamepad with force feedback impl
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
||||||
|
|
||||||
@@ -12,16 +13,22 @@ namespace EvilSatellites
|
|||||||
{
|
{
|
||||||
private KeyboardState OldKeyState;
|
private KeyboardState OldKeyState;
|
||||||
private KeyboardState NewKeyState;
|
private KeyboardState NewKeyState;
|
||||||
|
private GamePadState OldPadState;
|
||||||
|
private GamePadState NewPadState;
|
||||||
public InputManager()
|
public InputManager()
|
||||||
{
|
{
|
||||||
OldKeyState = Keyboard.GetState();
|
OldKeyState = Keyboard.GetState();
|
||||||
NewKeyState = Keyboard.GetState();
|
NewKeyState = Keyboard.GetState();
|
||||||
|
OldPadState = GamePad.GetState(PlayerIndex.One);
|
||||||
|
NewPadState = GamePad.GetState(PlayerIndex.One);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
OldKeyState = NewKeyState;
|
OldKeyState = NewKeyState;
|
||||||
NewKeyState = Keyboard.GetState();
|
NewKeyState = Keyboard.GetState();
|
||||||
|
OldPadState = NewPadState;
|
||||||
|
NewPadState = GamePad.GetState(PlayerIndex.One);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsJustPressed(Keys key)
|
public bool IsJustPressed(Keys key)
|
||||||
@@ -43,5 +50,25 @@ namespace EvilSatellites
|
|||||||
{
|
{
|
||||||
return NewKeyState.IsKeyUp(key);
|
return NewKeyState.IsKeyUp(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsJustPressed(Buttons key)
|
||||||
|
{
|
||||||
|
return (NewPadState.IsButtonDown(key) && !OldPadState.IsButtonDown(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsJustReleased(Buttons key)
|
||||||
|
{
|
||||||
|
return !NewPadState.IsButtonDown(key) && OldPadState.IsButtonDown(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPressed(Buttons key)
|
||||||
|
{
|
||||||
|
return NewPadState.IsButtonDown(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsReleased(Buttons key)
|
||||||
|
{
|
||||||
|
return !NewPadState.IsButtonDown(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ namespace EvilSatellites.Objects
|
|||||||
if (player.Vacuuming)
|
if (player.Vacuuming)
|
||||||
{
|
{
|
||||||
player.CurrentWeapon.Reload(rnd.Next(player.CurrentWeapon.MaxAmmo/4));
|
player.CurrentWeapon.Reload(rnd.Next(player.CurrentWeapon.MaxAmmo/4));
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
GameStats.DebrisCollected++;
|
GameStats.DebrisCollected++;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace EvilSatellites.Objects
|
|||||||
ShouldDestroy = false;
|
ShouldDestroy = false;
|
||||||
Active = true;
|
Active = true;
|
||||||
Type = ObjectType.Player;
|
Type = ObjectType.Player;
|
||||||
Position = new Vector3(5000, 5000, 4990);
|
Position = new Vector3(25000, 25000, 25000);
|
||||||
Dimensions = new Vector3(5, 5, 5);
|
Dimensions = new Vector3(5, 5, 5);
|
||||||
Movement = new Vector3(0, 0, 0);
|
Movement = new Vector3(0, 0, 0);
|
||||||
Rotation = Matrix.Identity;
|
Rotation = Matrix.Identity;
|
||||||
@@ -203,10 +203,12 @@ namespace EvilSatellites.Objects
|
|||||||
}
|
}
|
||||||
dmgSound += "/int/" + (rnd.Next(2)+1).ToString()+".wav";
|
dmgSound += "/int/" + (rnd.Next(2)+1).ToString()+".wav";
|
||||||
Screen.Manager.Sound.PlayOneshot(dmgSound);
|
Screen.Manager.Sound.PlayOneshot(dmgSound);
|
||||||
|
Screen.Manager.Vibrations.AddVibration(1, 1, 500);
|
||||||
if (Health < 1)
|
if (Health < 1)
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
Screen.Manager.Sound.PlayOneshot(@"sfx/physics/crashes/1.wav");
|
Screen.Manager.Sound.PlayOneshot(@"sfx/physics/crashes/1.wav");
|
||||||
|
Screen.Manager.Vibrations.AddVibration(1, 1, 1000);
|
||||||
var scr = (GameScreen)Screen;
|
var scr = (GameScreen)Screen;
|
||||||
scr.EndGame();
|
scr.EndGame();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,13 @@ namespace EvilSatellites
|
|||||||
private bool _Running = false;
|
private bool _Running = false;
|
||||||
public Synthy Sound;
|
public Synthy Sound;
|
||||||
public MusicManager Music;
|
public MusicManager Music;
|
||||||
|
public VibrationManager Vibrations;
|
||||||
public FDNReverb EnvironmentEffect;
|
public FDNReverb EnvironmentEffect;
|
||||||
public AudioListener Listener = new AudioListener();
|
|
||||||
public ScreenManager(Game instance): base(instance)
|
public ScreenManager(Game instance): base(instance)
|
||||||
{
|
{
|
||||||
Sound = new Synthy();
|
Sound = new Synthy();
|
||||||
Music = new MusicManager(Sound);
|
Music = new MusicManager(Sound);
|
||||||
|
Vibrations = new VibrationManager(PlayerIndex.One);
|
||||||
EnvironmentEffect = Sound.CreateReverb();
|
EnvironmentEffect = Sound.CreateReverb();
|
||||||
EnvironmentEffect.Delay = 0.03;
|
EnvironmentEffect.Delay = 0.03;
|
||||||
EnvironmentEffect.Wet = 30;
|
EnvironmentEffect.Wet = 30;
|
||||||
@@ -47,6 +48,7 @@ namespace EvilSatellites
|
|||||||
{
|
{
|
||||||
screen.Activate();
|
screen.Activate();
|
||||||
}
|
}
|
||||||
|
Vibrations.AddVibration(1, 1, 500);
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,6 +68,7 @@ namespace EvilSatellites
|
|||||||
|
|
||||||
public void Update(GameTime gameTime)
|
public void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
Vibrations.Update((float)gameTime.ElapsedGameTime.TotalMilliseconds);
|
||||||
if (_ToAdd.Count > 0)
|
if (_ToAdd.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var screen in _ToAdd)
|
foreach (var screen in _ToAdd)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace EvilSatellites.Screens
|
|||||||
public List<IGameObject> Objects = new List<IGameObject>();
|
public List<IGameObject> Objects = new List<IGameObject>();
|
||||||
public List<IGameObject> Removable = new List<IGameObject>();
|
public List<IGameObject> Removable = new List<IGameObject>();
|
||||||
public List<IGameObject> Addable = new List<IGameObject>();
|
public List<IGameObject> Addable = new List<IGameObject>();
|
||||||
private Quadtree<IGameObject> objtree = new Quadtree<IGameObject>(new Vector3(10000, 10000, 10000), 10, 20);
|
private Quadtree<IGameObject> objtree = new Quadtree<IGameObject>(new Vector3(50000, 50000, 50000), 10, 20);
|
||||||
private float Theta = 0;
|
private float Theta = 0;
|
||||||
private Player _player;
|
private Player _player;
|
||||||
private Radar ObjectRadar;
|
private Radar ObjectRadar;
|
||||||
@@ -83,9 +83,6 @@ namespace EvilSatellites.Screens
|
|||||||
Manager.Sound.ListenerPosition = new System.Numerics.Vector3(obj.Position.X+obj.Dimensions.X/2, obj.Position.Y+obj.Dimensions.Y/2, obj.Position.Z+obj.Dimensions.Z/2);
|
Manager.Sound.ListenerPosition = new System.Numerics.Vector3(obj.Position.X+obj.Dimensions.X/2, obj.Position.Y+obj.Dimensions.Y/2, obj.Position.Z+obj.Dimensions.Z/2);
|
||||||
Manager.Sound.ListenerOrientationForward = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Forward.X, obj.Rotation.Forward.Y, obj.Rotation.Forward.Z));
|
Manager.Sound.ListenerOrientationForward = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Forward.X, obj.Rotation.Forward.Y, obj.Rotation.Forward.Z));
|
||||||
Manager.Sound.ListenerOrientationUpwards = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Up.X, obj.Rotation.Up.Y, obj.Rotation.Up.Z));
|
Manager.Sound.ListenerOrientationUpwards = System.Numerics.Vector3.Normalize(new System.Numerics.Vector3(obj.Rotation.Up.X, obj.Rotation.Up.Y, obj.Rotation.Up.Z));
|
||||||
Manager.Listener.Position = obj.Position;
|
|
||||||
Manager.Listener.Forward = obj.Rotation.Forward;
|
|
||||||
Manager.Listener.Up = obj.Rotation.Up;
|
|
||||||
}
|
}
|
||||||
if (obj.ShouldDestroy)
|
if (obj.ShouldDestroy)
|
||||||
{
|
{
|
||||||
@@ -108,19 +105,19 @@ namespace EvilSatellites.Screens
|
|||||||
{
|
{
|
||||||
Input.Update();
|
Input.Update();
|
||||||
Vector3 move = new Vector3(0, 0, 0);
|
Vector3 move = new Vector3(0, 0, 0);
|
||||||
if (Input.IsPressed(Keys.W))
|
if (Input.IsPressed(Keys.W) || Input.IsPressed(Buttons.LeftThumbstickUp))
|
||||||
{
|
{
|
||||||
move.Z = -_player.Acceleration.Z;
|
move.Z = -_player.Acceleration.Z;
|
||||||
}
|
}
|
||||||
if (Input.IsPressed(Keys.S))
|
if (Input.IsPressed(Keys.S) || Input.IsPressed(Buttons.LeftThumbstickDown))
|
||||||
{
|
{
|
||||||
move.Z = _player.Acceleration.Z;
|
move.Z = _player.Acceleration.Z;
|
||||||
}
|
}
|
||||||
if (Input.IsPressed(Keys.A))
|
if (Input.IsPressed(Keys.A) || Input.IsPressed(Buttons.LeftThumbstickLeft))
|
||||||
{
|
{
|
||||||
move.X = -_player.Acceleration.X;
|
move.X = -_player.Acceleration.X;
|
||||||
}
|
}
|
||||||
if (Input.IsPressed(Keys.D))
|
if (Input.IsPressed(Keys.D) || Input.IsPressed(Buttons.LeftThumbstickRight))
|
||||||
{
|
{
|
||||||
move.X = _player.Acceleration.X;
|
move.X = _player.Acceleration.X;
|
||||||
}
|
}
|
||||||
@@ -128,49 +125,49 @@ namespace EvilSatellites.Screens
|
|||||||
{
|
{
|
||||||
_player.PlayTap();
|
_player.PlayTap();
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.Left))
|
if (Input.IsJustPressed(Keys.Left) || Input.IsJustPressed(Buttons.RightThumbstickLeft))
|
||||||
{
|
{
|
||||||
_player.StartTurning(-1, gameTime);
|
_player.StartTurning(-1, gameTime);
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.Right))
|
if (Input.IsJustPressed(Keys.Right) || Input.IsJustPressed(Buttons.RightThumbstickRight))
|
||||||
{
|
{
|
||||||
_player.StartTurning(1, gameTime);
|
_player.StartTurning(1, gameTime);
|
||||||
}
|
}
|
||||||
if (Input.IsJustReleased(Keys.Left) || Input.IsJustReleased(Keys.Right))
|
if (Input.IsJustReleased(Keys.Left) || Input.IsJustReleased(Keys.Right) || Input.IsJustReleased(Buttons.RightThumbstickLeft) || Input.IsJustReleased(Buttons.RightThumbstickRight))
|
||||||
{
|
{
|
||||||
_player.StopTurning();
|
_player.StopTurning();
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.Up))
|
if (Input.IsJustPressed(Keys.Up) || Input.IsJustPressed(Buttons.RightThumbstickUp))
|
||||||
{
|
{
|
||||||
_player.StartElevating(-1, gameTime);
|
_player.StartElevating(-1, gameTime);
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.Down))
|
if (Input.IsJustPressed(Keys.Down) || Input.IsJustPressed(Buttons.RightThumbstickDown))
|
||||||
{
|
{
|
||||||
_player.StartElevating(1, gameTime);
|
_player.StartElevating(1, gameTime);
|
||||||
}
|
}
|
||||||
if (Input.IsJustReleased(Keys.Up) || Input.IsJustReleased(Keys.Down))
|
if (Input.IsJustReleased(Keys.Up) || Input.IsJustReleased(Keys.Down) || Input.IsJustReleased(Buttons.RightThumbstickUp) || Input.IsJustReleased(Buttons.RightThumbstickDown))
|
||||||
{
|
{
|
||||||
_player.StopElevating();
|
_player.StopElevating();
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.V))
|
if (Input.IsJustPressed(Keys.V) || Input.IsJustPressed(Buttons.LeftTrigger))
|
||||||
{
|
{
|
||||||
_player.StartVacuuming(gameTime);
|
_player.StartVacuuming(gameTime);
|
||||||
}
|
}
|
||||||
if (Input.IsJustReleased(Keys.V))
|
if (Input.IsJustReleased(Keys.V) || Input.IsJustReleased(Buttons.LeftTrigger))
|
||||||
{
|
{
|
||||||
_player.StopVacuuming();
|
_player.StopVacuuming();
|
||||||
}
|
}
|
||||||
_player.Accelerate(move);
|
_player.Accelerate(move);
|
||||||
if (Input.IsJustPressed(Keys.Space))
|
if (Input.IsJustPressed(Keys.Space) || Input.IsJustPressed(Buttons.RightTrigger))
|
||||||
{
|
{
|
||||||
_player.CurrentWeapon.Shoot(gameTime);
|
_player.CurrentWeapon.Shoot(gameTime);
|
||||||
_player.PlayTap();
|
_player.PlayTap();
|
||||||
}
|
}
|
||||||
if (Input.IsJustReleased(Keys.Space))
|
if (Input.IsJustReleased(Keys.Space) || Input.IsJustReleased(Buttons.RightTrigger))
|
||||||
{
|
{
|
||||||
_player.CurrentWeapon.Stop();
|
_player.CurrentWeapon.Stop();
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.R))
|
if (Input.IsJustPressed(Keys.R) || Input.IsJustPressed(Buttons.LeftShoulder))
|
||||||
{
|
{
|
||||||
_player.PlayTap();
|
_player.PlayTap();
|
||||||
if (ObjectRadar.Active)
|
if (ObjectRadar.Active)
|
||||||
@@ -181,7 +178,7 @@ namespace EvilSatellites.Screens
|
|||||||
ObjectRadar.Start();
|
ObjectRadar.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.T))
|
if (Input.IsJustPressed(Keys.T) || Input.IsJustPressed(Buttons.RightShoulder))
|
||||||
{
|
{
|
||||||
_player.PlayTap();
|
_player.PlayTap();
|
||||||
if (ObjectRadar.Filter == ObjectType.Satellite)
|
if (ObjectRadar.Filter == ObjectType.Satellite)
|
||||||
@@ -194,17 +191,17 @@ namespace EvilSatellites.Screens
|
|||||||
Tolk.Output("Satellites");
|
Tolk.Output("Satellites");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.H))
|
if (Input.IsJustPressed(Keys.H) || Input.IsJustPressed(Buttons.B))
|
||||||
{
|
{
|
||||||
_player.PlayTap();
|
_player.PlayTap();
|
||||||
Tolk.Output(Math.Round(_player.Health).ToString() + " health", true);
|
Tolk.Output(Math.Round(_player.Health).ToString() + " health", true);
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.X))
|
if (Input.IsJustPressed(Keys.X) || Input.IsJustPressed(Buttons.A))
|
||||||
{
|
{
|
||||||
_player.PlayTap();
|
_player.PlayTap();
|
||||||
Tolk.Output(_player.CurrentWeapon.RemainingAmmo.ToString() + " rounds", true);
|
Tolk.Output(_player.CurrentWeapon.RemainingAmmo.ToString() + " rounds", true);
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.Y))
|
if (Input.IsJustPressed(Keys.Y) || Input.IsJustPressed(Buttons.X))
|
||||||
{
|
{
|
||||||
_player.PlayTap();
|
_player.PlayTap();
|
||||||
if (ObjectRadar.Target != null)
|
if (ObjectRadar.Target != null)
|
||||||
@@ -231,7 +228,7 @@ namespace EvilSatellites.Screens
|
|||||||
{
|
{
|
||||||
Manager.Music.Volume = Manager.Music.Volume - 0.05f;
|
Manager.Music.Volume = Manager.Music.Volume - 0.05f;
|
||||||
}
|
}
|
||||||
if (Input.IsJustPressed(Keys.Escape))
|
if (Input.IsJustPressed(Keys.Escape) || Input.IsJustPressed(Buttons.Start))
|
||||||
{
|
{
|
||||||
EndGame();
|
EndGame();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ namespace EvilSatellites.Screens
|
|||||||
public ScreenManager _Manager;
|
public ScreenManager _Manager;
|
||||||
public ScreenState _State;
|
public ScreenState _State;
|
||||||
public InputManager Inputs = new InputManager();
|
public InputManager Inputs = new InputManager();
|
||||||
|
private double DescWaitTime;
|
||||||
|
private bool DescRead;
|
||||||
public ScreenManager Manager { get => _Manager; set => _Manager = value; }
|
public ScreenManager Manager { get => _Manager; set => _Manager = value; }
|
||||||
public ScreenState State { get => _State; set => _State = value; }
|
public ScreenState State { get => _State; set => _State = value; }
|
||||||
|
|
||||||
@@ -30,6 +30,8 @@ namespace EvilSatellites.Screens
|
|||||||
Tolk.Output(MenuOptions.Entries[CursorPosition].Name);
|
Tolk.Output(MenuOptions.Entries[CursorPosition].Name);
|
||||||
Manager.Sound.PlayOneshot(@"sfx/ui/menuOpen.wav");
|
Manager.Sound.PlayOneshot(@"sfx/ui/menuOpen.wav");
|
||||||
Manager.Music.Play("menu1");
|
Manager.Music.Play("menu1");
|
||||||
|
DescWaitTime = 0;
|
||||||
|
DescRead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Deactivate()
|
public virtual void Deactivate()
|
||||||
@@ -40,15 +42,15 @@ namespace EvilSatellites.Screens
|
|||||||
public void HandleInput(GameTime gameTime, KeyboardState inputs)
|
public void HandleInput(GameTime gameTime, KeyboardState inputs)
|
||||||
{
|
{
|
||||||
Inputs.Update();
|
Inputs.Update();
|
||||||
if (Inputs.IsJustPressed(Keys.Down))
|
if (Inputs.IsJustPressed(Keys.Down) || Inputs.IsJustPressed(Buttons.DPadDown))
|
||||||
{
|
{
|
||||||
NextItem();
|
NextItem();
|
||||||
}
|
}
|
||||||
if (Inputs.IsJustPressed(Keys.Up))
|
if (Inputs.IsJustPressed(Keys.Up) || Inputs.IsJustPressed(Buttons.DPadUp))
|
||||||
{
|
{
|
||||||
PreviousItem();
|
PreviousItem();
|
||||||
}
|
}
|
||||||
if (Inputs.IsJustPressed(Keys.Enter))
|
if (Inputs.IsJustPressed(Keys.Enter) || Inputs.IsJustPressed(Buttons.A))
|
||||||
{
|
{
|
||||||
SelectItem();
|
SelectItem();
|
||||||
}
|
}
|
||||||
@@ -57,7 +59,12 @@ namespace EvilSatellites.Screens
|
|||||||
public virtual void Update(GameTime gameTime)
|
public virtual void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
Manager.Sound.Update();
|
Manager.Sound.Update();
|
||||||
|
DescWaitTime += gameTime.ElapsedGameTime.TotalMilliseconds;
|
||||||
|
if (DescWaitTime > 2000 && DescRead == false)
|
||||||
|
{
|
||||||
|
Tolk.Output(MenuOptions.Entries[CursorPosition].Description, false);
|
||||||
|
DescRead = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PreviousItem()
|
public void PreviousItem()
|
||||||
@@ -92,6 +99,8 @@ namespace EvilSatellites.Screens
|
|||||||
{
|
{
|
||||||
Manager.Sound.PlayOneshot(@"sfx/ui/menuMove.wav");
|
Manager.Sound.PlayOneshot(@"sfx/ui/menuMove.wav");
|
||||||
Tolk.Output(MenuOptions.Entries[CursorPosition].Name, true);
|
Tolk.Output(MenuOptions.Entries[CursorPosition].Name, true);
|
||||||
|
DescRead = false;
|
||||||
|
DescWaitTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SelectItem()
|
public virtual void SelectItem()
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace EvilSatellites.Screens
|
|||||||
.Add(new MenuEntry("Satellites shot: " + GameStats.SatellitesShot.ToString(), "Amount of satellites shot during this game."))
|
.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("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("Satellite collisions: " + GameStats.SatelliteCollisions.ToString(), "How many satellites you crashed into"))
|
||||||
.Add(new MenuEntry("Total play time: " + GameStats.TotalPlayTime.ToString(), "How much time you spent on this run"))
|
.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"));
|
.Add(new MenuEntry("OK", "Go back to main menu"));
|
||||||
base.Activate();
|
base.Activate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
||||||
|
namespace EvilSatellites
|
||||||
|
{
|
||||||
|
public class Vibration
|
||||||
|
{
|
||||||
|
float leftMotor;
|
||||||
|
float rightMotor;
|
||||||
|
float msLeft;
|
||||||
|
|
||||||
|
public float LeftMotor
|
||||||
|
{
|
||||||
|
get { return leftMotor; }
|
||||||
|
set { leftMotor = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float RightMotor
|
||||||
|
{
|
||||||
|
get { return rightMotor; }
|
||||||
|
set { rightMotor = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float MSLeft
|
||||||
|
{
|
||||||
|
get { return msLeft; }
|
||||||
|
set { msLeft = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vibration(float leftMotor, float rightMotor, float durationMS)
|
||||||
|
{
|
||||||
|
this.leftMotor = leftMotor;
|
||||||
|
this.rightMotor = rightMotor;
|
||||||
|
this.msLeft = durationMS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
||||||
|
namespace EvilSatellites
|
||||||
|
{
|
||||||
|
public class VibrationManager
|
||||||
|
{
|
||||||
|
private PlayerIndex playerIndex;
|
||||||
|
List<Vibration> vibrations = new List<Vibration>();
|
||||||
|
|
||||||
|
public VibrationManager(PlayerIndex playerIndex)
|
||||||
|
{
|
||||||
|
this.playerIndex = playerIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddVibration(float leftMotor, float rightMotor, float durationMS)
|
||||||
|
{
|
||||||
|
vibrations.Add(new Vibration(leftMotor, rightMotor, durationMS));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(float msElapsed)
|
||||||
|
{
|
||||||
|
List<Vibration> toDelete = new List<Vibration>();
|
||||||
|
|
||||||
|
foreach (Vibration vibration in vibrations)
|
||||||
|
{
|
||||||
|
vibration.MSLeft -= msElapsed;
|
||||||
|
|
||||||
|
if (vibration.MSLeft < 0.0f)
|
||||||
|
{
|
||||||
|
toDelete.Add(vibration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Vibration vibration in toDelete)
|
||||||
|
{
|
||||||
|
vibrations.Remove(vibration);
|
||||||
|
}
|
||||||
|
|
||||||
|
float leftMotor;
|
||||||
|
float rightMotor;
|
||||||
|
|
||||||
|
GetVibration(out leftMotor, out rightMotor);
|
||||||
|
|
||||||
|
GamePad.SetVibration(playerIndex, leftMotor, rightMotor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetVibration(out float leftMotor, out float rightMotor)
|
||||||
|
{
|
||||||
|
leftMotor = 0.0f;
|
||||||
|
rightMotor = 0.0f;
|
||||||
|
|
||||||
|
foreach (Vibration vibration in vibrations)
|
||||||
|
{
|
||||||
|
leftMotor = Math.Max(leftMotor, vibration.LeftMotor);
|
||||||
|
rightMotor = Math.Max(rightMotor, vibration.RightMotor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ namespace EvilSatellites.Weapons
|
|||||||
Screen = screen;
|
Screen = screen;
|
||||||
MaxAmmo = 250;
|
MaxAmmo = 250;
|
||||||
RemainingAmmo = MaxAmmo;
|
RemainingAmmo = MaxAmmo;
|
||||||
FireRate = 90;
|
FireRate = 150;
|
||||||
State = WeaponState.Stopped;
|
State = WeaponState.Stopped;
|
||||||
LoadSounds();
|
LoadSounds();
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ namespace EvilSatellites.Weapons
|
|||||||
sfxSpinup = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/spinup.wav", false);
|
sfxSpinup = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/spinup.wav", false);
|
||||||
sfxSpinning = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/spinning.wav", false);
|
sfxSpinning = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/spinning.wav", false);
|
||||||
sfxSpinning.Loop = true;
|
sfxSpinning.Loop = true;
|
||||||
sfxShoot = new AudioAsset(Screen.Manager.Sound, @"sfx/weapons/LaserMG/fire", 1, 4);
|
sfxShoot = new AudioAsset(Screen.Manager.Sound, @"sfx/weapons/LaserMG/fire", 1, 5);
|
||||||
sfxEmpty = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/empty.wav", false);
|
sfxEmpty = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/empty.wav", false);
|
||||||
sfxEmpty.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
sfxEmpty.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||||
sfxReload.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
sfxReload.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||||
@@ -90,6 +90,7 @@ namespace EvilSatellites.Weapons
|
|||||||
if (RemainingAmmo > 0)
|
if (RemainingAmmo > 0)
|
||||||
{
|
{
|
||||||
sfxShoot.Play();
|
sfxShoot.Play();
|
||||||
|
Screen.Manager.Vibrations.AddVibration(1, 1, 100);
|
||||||
RemainingAmmo--;
|
RemainingAmmo--;
|
||||||
TimerStart = TimerEnd;
|
TimerStart = TimerEnd;
|
||||||
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation, _wielder);
|
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation, _wielder);
|
||||||
@@ -119,6 +120,7 @@ namespace EvilSatellites.Weapons
|
|||||||
RemainingAmmo += amount;
|
RemainingAmmo += amount;
|
||||||
sfxReload.Reset();
|
sfxReload.Reset();
|
||||||
sfxReload.Play();
|
sfxReload.Play();
|
||||||
|
Screen.Manager.Vibrations.AddVibration(1, 1, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:a3b0d5e043ebed222700820ce1c55d9c17dca63818f3d1b5b1e2d1902329a9b7
|
|
||||||
size 1823142
|
|
||||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:108d766249e2f51f330b0284e575a1d64936414cad0e4446f1bdf30a72e5a730
|
|
||||||
size 2089826
|
|
||||||
Binary file not shown.
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:70cee281d65bdf707d46e5ecba24c98ae6066b85965fd930826becaedf78a532
|
oid sha256:d9548b87d27e66caf23ac5b4e339900388698ae6f1c0f7caa1b14a656f878217
|
||||||
size 2508512
|
size 2508512
|
||||||
|
|||||||
Binary file not shown.
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:182dff19352c93c533e164ab8d1aca1579022ac9ae26be41e2ffa1033c8d73ec
|
oid sha256:e8dfb632f69ecb773779ce6d3229d5a46faae99bfc3aa12b9c625aaade46d018
|
||||||
size 1429960
|
size 1429960
|
||||||
|
|||||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:79fc765256e9b99f1b34de78fcbc38b6685caecf1b3b948896c04a8285eebe86
|
|
||||||
size 2876306
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:21fe42fb9aef435fd94bfab29cb5792ad219231c28ab02a589e0d75cc453ef9a
|
|
||||||
size 430184
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:d5297bd23f5a4dfe62b10beb547652327ee3f7a29439c3996b73e223ffc3c250
|
|
||||||
size 442472
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:9e9878ae9f183394009ed4a6a5878b90ae598543e7b7224d2a21f36a5a500f71
|
|
||||||
size 460904
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:cada75a6d88118b4f6c0e1dfc052b1b06725a0857b31579bc9055b95415a2fa6
|
|
||||||
size 409704
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:0c0d917fd4ca24e134971cd127c235f34e9c50d496355f142ab821388b396bd2
|
|
||||||
size 395368
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:985a5aaa3fd5b4f80e46790c3150cabcf51e0e2e247562bfe6e0c8d64408b077
|
|
||||||
size 424040
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:47a7e2649bd0513dd8a826d174d43aa2ab58f1bf3e04acb5eb312af699e6eb00
|
|
||||||
size 403560
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:ac884f3ce0ba07ded98cf14039e1f0fda8d316ed03d7d886b8f91733628bd90e
|
|
||||||
size 133132
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:ba3e5e7c9e4adcd0fa26c5aab2c0efdd0d92a6cba19c6b19a785cfd1e231a44d
|
|
||||||
size 136780
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:9dcc26bc353473406a5ce1d152bf104a1b97dc4f776ed836eee3601f41737e86
|
|
||||||
size 112558
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:6866924e3ce77bb73a8fe78300e7f88da22aab220fb856d82a0f2b063dab8f63
|
|
||||||
size 119506
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:53b4150409ec140af2fa72ef99ac8615f11b63e35210b71ff02c8787011201eb
|
|
||||||
size 163972
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:5295e17040ed2ecb7f5fb635b6f04b7c32b482e0f20ef0a6974d55d30270b6fb
|
|
||||||
size 258256
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:4ce5d862af7ce41f1e7f524d526eeb7a057752cff9d251dfeb996e883a01a15a
|
|
||||||
size 159700
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:30f154c29ee01c7e2294c660a2736709ec088df715e0d5e68c90fa317f7fa2b8
|
|
||||||
size 245864
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:3c595557f6dd08080a7e7f3595d5fece1e0bf7d57553f6ad552423746ff941bf
|
|
||||||
size 335976
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:d964bd7051412c0901af58c8ea3782e6907c2e0294eaca37028620dfe645212c
|
|
||||||
size 286824
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:f1c83dcb75dcb70eaab586c6e3acee452b5e4aadef80e06b189088f4b4d127f7
|
|
||||||
size 176232
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:1be3e931b1529a0caa4aaf27d378a93ec03a57884f4bb16dcd5d7aa342730c20
|
|
||||||
size 176232
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:9b81d6ee3c61e33f527cf61a23dcdaa1fdfb2c4cfa086e4e1d789b8332b57462
|
|
||||||
size 329832
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:938528842f460b8ab3d4303fbacedc6d0906f4856f1ae962e8891cf0535ec467
|
|
||||||
size 327784
|
|
||||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:337123c8d25333c158e719e809d2a934d884df4f8c047d02625e53d6a26230af
|
|
||||||
size 654142
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:27bb2c5f1b6708c5987fbde107337e5830b2fc15f741c5373a28e2201b715b88
|
|
||||||
size 1051854
|
|
||||||
Binary file not shown.
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:d67a5591a021c4f05ec01ce8d5f034fb0cf23b68fa8d9dc8130d6117ff3e754e
|
oid sha256:2743c36a6b8c4a3a46a0e52ae972c3182d2cf4bf20f5e2abbec5c645b4da2367
|
||||||
size 1870856
|
size 1870856
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:e77b8f1eaeb2b2607132cc43d9046ad3d56177202454f4ae5d35742d54340586
|
oid sha256:a504b74a0f3361db8850296691570ddbaa951603be4de213acad45b34a6419bf
|
||||||
size 96104
|
size 96104
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:865ed11ccfdca229def0fd1728166669d51cee6310c0d4d25d839b7878b86a3b
|
oid sha256:3fc67891fdcddfd8a66dd55b9cfaccacdd8bf9598b4cc198d057ea121836afc7
|
||||||
size 384104
|
size 384104
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:e36997d01bf4ec1c9356db9e73543a8ca9af92c92f55cbacc03b0dc0f2bb45a9
|
oid sha256:ad34fbed7642862f76b5aeb82cae18dbeb28097eec9eb29d0b4469d1511e79f2
|
||||||
size 96104
|
size 96104
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:d9900107ff88f63ee5e8d68ef1cf038f47dcdcae3e252bf9b95df695ad1fb955
|
|
||||||
size 12536
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:42b59d004164a9851701bbc43435f6380caa28a6c5bda39dffbb6908215ba16d
|
|
||||||
size 24596
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:d34d6dd7dddd80cfd4a20e0729644b5b4d76eb25177239d0600850ce75d30a9b
|
|
||||||
size 182148
|
|
||||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:07cc958b1de51f624133aba86181fdcadde2fde9d12b0c16f7feac4bdf29fb94
|
|
||||||
size 8512
|
|
||||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:031fcd549601d22afcb4c661ec02a5244fad941ad181b62c73f2273268e5937b
|
|
||||||
size 21686
|
|
||||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:78e61118c6504226fefbdbf1f24c9ec4f5dc8d983ee520206fed0566e23c17f5
|
|
||||||
size 119526
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:baf4ad57a88674a27eedd1d03e46c158673f2046a0f2fbd33a2b3f9c63012af2
|
|
||||||
size 715046
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user