From e846c64d6f927879cb8a095e62d773a8d7b3c9f4 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Oct 2020 07:24:10 +0800 Subject: *ability system --- Assets/Scripts/Input/Command.cs | 2 ++ Assets/Scripts/Input/InputManager.cs | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'Assets/Scripts/Input') diff --git a/Assets/Scripts/Input/Command.cs b/Assets/Scripts/Input/Command.cs index 5ac2c2a0..7649af58 100644 --- a/Assets/Scripts/Input/Command.cs +++ b/Assets/Scripts/Input/Command.cs @@ -24,11 +24,13 @@ public struct Command { public CommandCode code; // 指令码 public float time; // 触发时间 + public int id; public Command(CommandCode code, float time) { this.code = code; this.time = time; + this.id = UIDManager.Acquire(); } } diff --git a/Assets/Scripts/Input/InputManager.cs b/Assets/Scripts/Input/InputManager.cs index c1a26327..95f63ad7 100644 --- a/Assets/Scripts/Input/InputManager.cs +++ b/Assets/Scripts/Input/InputManager.cs @@ -6,6 +6,7 @@ public class InputManager : Singleton { private List m_CommandRecord; private Command m_CurrentCommand; + private readonly int kCommandRecords = 10; public void Init() { @@ -40,8 +41,12 @@ public class InputManager : Singleton float time = Time.time; Command command = new Command(cmd, time); Debug.Log(CommandToString(command)); + m_CurrentCommand = command; m_CommandRecord.Add(command); + + if(m_CommandRecord.Count > 10) + m_CommandRecord.RemoveRange(0, m_CommandRecord.Count - 10); } } @@ -64,7 +69,7 @@ public class InputManager : Singleton string CommandToString(Command cmd) { string sign = CommandCodeToString(cmd.code); - return sign + " " + cmd.time + "s"; + return sign + " " + cmd.time + "s" + " " + cmd.id; } } -- cgit v1.1-26-g67d0