-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
359 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using UnityEngine; | ||
|
||
public class KeyboardManager { | ||
|
||
//public static KeyCode BrushStrength = KeyCode.V; | ||
//public static KeyCode BrushSize = KeyCode.B; | ||
|
||
public static bool BrushStrengthDown(){ | ||
return Input.GetKeyDown(KeyCode.V) || Input.GetKeyDown(KeyCode.S); | ||
} | ||
|
||
public static bool BrushStrengthHold() | ||
{ | ||
return Input.GetKey(KeyCode.V) || Input.GetKey(KeyCode.S); | ||
} | ||
|
||
public static bool BrushSizeDown() | ||
{ | ||
return Input.GetKeyDown(KeyCode.B) || Input.GetKeyDown(KeyCode.W); | ||
} | ||
|
||
public static bool BrushSizeHold() | ||
{ | ||
return Input.GetKey(KeyCode.B) || Input.GetKey(KeyCode.W); | ||
} | ||
|
||
public static bool SwitchTypeNext() | ||
{ | ||
return Input.GetKeyDown(KeyCode.Tab); | ||
} | ||
|
||
public static bool SwitchType1() | ||
{ | ||
return Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1); | ||
} | ||
|
||
public static bool SwitchType2() | ||
{ | ||
return Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2); | ||
} | ||
|
||
public static bool SwitchType3() | ||
{ | ||
return Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3); | ||
} | ||
|
||
public static bool SwitchType4() | ||
{ | ||
return Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4); | ||
} | ||
|
||
const float ClickDownOffset = 0.5f; | ||
const float ClickOffset = 0.1f; | ||
|
||
static float LastClickTime = 0; | ||
public static bool IncreaseTarget() | ||
{ | ||
if(Input.GetKeyDown(KeyCode.Q) || Input.GetKeyDown(KeyCode.Plus) || Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.KeypadPlus)) | ||
{ | ||
LastClickTime = Time.realtimeSinceStartup + ClickDownOffset; | ||
return true; | ||
} | ||
else if(Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.Plus) || Input.GetKey(KeyCode.Equals) || Input.GetKey(KeyCode.KeypadPlus)) | ||
{ | ||
if(Time.realtimeSinceStartup > LastClickTime) | ||
{ | ||
LastClickTime = Time.realtimeSinceStartup + ClickOffset; | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public static bool DecreaseTarget() | ||
{ | ||
if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.KeypadMinus)) | ||
{ | ||
LastClickTime = Time.realtimeSinceStartup + ClickDownOffset; | ||
return true; | ||
} | ||
else if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.Minus) || Input.GetKey(KeyCode.KeypadMinus)) | ||
{ | ||
if (Time.realtimeSinceStartup > LastClickTime) | ||
{ | ||
LastClickTime = Time.realtimeSinceStartup + ClickOffset; | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.