| | 1 | | // Copyright (c) 2020-2022 dotBunny Inc. |
| | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | 3 | | // See the LICENSE file in the project root for more information. |
| | 4 | |
|
| | 5 | | namespace GDX.Developer.ConsoleCommands |
| | 6 | | { |
| | 7 | | #if UNITY_2022_2_OR_NEWER |
| | 8 | | public class WaitConsoleCommand : ConsoleCommandBase |
| | 9 | | { |
| | 10 | | float m_WaitTime; |
| | 11 | |
|
| | 12 | | /// <inheritdoc /> |
| | 13 | | public override bool Evaluate(float deltaTime) |
| 0 | 14 | | { |
| 0 | 15 | | m_WaitTime -= deltaTime; |
| 0 | 16 | | return !(m_WaitTime > 0); |
| 0 | 17 | | } |
| | 18 | |
|
| | 19 | | /// <inheritdoc /> |
| | 20 | | public override string GetKeyword() |
| 7 | 21 | | { |
| 7 | 22 | | return "wait"; |
| 7 | 23 | | } |
| | 24 | |
|
| | 25 | | /// <inheritdoc /> |
| | 26 | | public override string GetHelpUsage() |
| 0 | 27 | | { |
| 0 | 28 | | return "wait [seconds]"; |
| 0 | 29 | | } |
| | 30 | |
|
| | 31 | | /// <inheritdoc /> |
| | 32 | | public override string GetHelpMessage() |
| 0 | 33 | | { |
| 0 | 34 | | return "Waits for a given period of time, till the next update if nothing is provided."; |
| 0 | 35 | | } |
| | 36 | |
|
| | 37 | | /// <inheritdoc /> |
| | 38 | | public override ConsoleCommandBase GetInstance(string context) |
| 0 | 39 | | { |
| 0 | 40 | | WaitConsoleCommand command = new WaitConsoleCommand(); |
| 0 | 41 | | float.TryParse(context, out float result); |
| 0 | 42 | | command.m_WaitTime = result; |
| 0 | 43 | | return command; |
| 0 | 44 | | } |
| | 45 | | } |
| | 46 | | #endif // UNITY_2022_2_OR_NEWER |
| | 47 | | } |