summaryrefslogtreecommitdiff
path: root/Erika/Assets/Scripts/Input/DeviceKeyboardMouse.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Erika/Assets/Scripts/Input/DeviceKeyboardMouse.cs')
-rw-r--r--Erika/Assets/Scripts/Input/DeviceKeyboardMouse.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/Erika/Assets/Scripts/Input/DeviceKeyboardMouse.cs b/Erika/Assets/Scripts/Input/DeviceKeyboardMouse.cs
new file mode 100644
index 00000000..71a0172b
--- /dev/null
+++ b/Erika/Assets/Scripts/Input/DeviceKeyboardMouse.cs
@@ -0,0 +1,45 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 鼠标键盘输入,不应该涉及角色逻辑
+/// </summary>
+public sealed class DeviceKeyboardMouse : DeviceBase
+{
+ protected override void Update()
+ {
+ ProcessKey();
+ ProcessMouse();
+ }
+
+ // 键盘
+ private void ProcessKey()
+ {
+ float horizontal = Input.GetAxisRaw("Horizontal");
+
+ EUnitDirection dir = EUnitDirection.None;
+ if (horizontal == 1)
+ dir = EUnitDirection.Right;
+ else if (horizontal == -1)
+ dir = EUnitDirection.Left;
+
+ InputManager.Instance.InputTurn(dir);
+ InputManager.Instance.InputMove(dir);
+
+ if (Input.GetKeyDown("j"))
+ {
+ InputManager.Instance.InputSkill(1);
+ }
+ if (Input.GetKeyDown("k"))
+ {
+ InputManager.Instance.InputSkill(2);
+ }
+ }
+
+ // 鼠标
+ private void ProcessMouse()
+ {
+ }
+
+}