Add basic radar and weapon

This commit is contained in:
2021-04-11 17:09:57 +02:00
parent 1c2fc7b86b
commit 2f7759d190
26 changed files with 465 additions and 45 deletions
+47
View File
@@ -0,0 +1,47 @@
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 InputManager
{
private KeyboardState OldKeyState;
private KeyboardState NewKeyState;
public InputManager()
{
OldKeyState = Keyboard.GetState();
NewKeyState = Keyboard.GetState();
}
public void Update()
{
OldKeyState = NewKeyState;
NewKeyState = Keyboard.GetState();
}
public bool IsJustPressed(Keys key)
{
return (NewKeyState.IsKeyDown(key) && !OldKeyState.IsKeyDown(key));
}
public bool IsJustReleased(Keys key)
{
return !NewKeyState.IsKeyDown(key) && OldKeyState.IsKeyDown(key);
}
public bool IsPressed(Keys key)
{
return NewKeyState.IsKeyDown(key);
}
public bool IsReleased(Keys key)
{
return NewKeyState.IsKeyUp(key);
}
}
}