StellarXipher/Assets/Puzzles/Mines/Scripts/Input/Keyboard.cs
EthanPisani d479a27770
All checks were successful
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Successful in 5m17s
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Successful in 5m19s
Build project / Publish to itch.io (StandaloneLinux64) (push) Successful in 5s
Build project / Publish to itch.io (StandaloneWindows64) (push) Successful in 5s
add mines puzzle game to unlock doors
2025-03-16 12:08:54 -04:00

58 lines
1.4 KiB
C#

using UnityEngine;
public static class Keyboard {
#region Properties
/// <summary>
/// Returns true is any key is currently held
/// </summary>
public static bool IsAnyKeyDown {
get { return Input.anyKey; }
}
/// <summary>
/// Returns true if any key was pressed this frame
/// </summary>
public static bool IsAnyKeyPressed {
get { return Input.anyKeyDown; }
}
#endregion
#region Methods
/// <summary>
/// Returns true if the key is currently held down
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static bool IsKeyDown(KeyCode key) {
return Input.GetKey(key);
}
/// <summary>
/// Returns true if the key is currently not held down
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static bool IsKeyUp(KeyCode key) {
return !IsKeyDown(key);
}
/// <summary>
/// Returns true if key was pressed this frame
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static bool IsKeyPressed(KeyCode key) {
return Input.GetKeyDown(key);
}
/// <summary>
/// Returns true if key was released this frame
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static bool IsKeyReleased(KeyCode key) {
return Input.GetKeyUp(key);
}
#endregion
}