Cyber/Assets/Scripts/Console/DebugConsoleAction.cs

42 lines
1.3 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2017-05-08 23:03:02 +02:00
namespace Cyber.Console {
2017-05-08 21:59:35 +02:00
/// <summary>
2017-05-08 23:03:02 +02:00
/// Class that defines an action that commands in the
/// <see cref="DebugConsole"/> might use.
2017-05-08 21:59:35 +02:00
/// </summary>
2017-05-08 23:03:02 +02:00
public class DebugConsoleAction {
/// <summary>
/// A delegate for all of the actions that commands do.
/// </summary>
public delegate void Action(List<string> command);
2017-05-08 23:03:02 +02:00
/// <summary>
/// A description that will be shown when using the "help (command)" command in the console.
/// </summary>
public readonly string Description;
2017-05-08 23:03:02 +02:00
private Action ActionFunc;
2017-05-08 23:03:02 +02:00
/// <summary>
/// Initializes a new instance of the <see cref="DebugConsoleAction"/> class.
/// </summary>
/// <param name="description">Description.</param>
/// <param name="actionFunc">Action func.</param>
public DebugConsoleAction(string description, Action actionFunc) {
this.Description = description;
this.ActionFunc = actionFunc;
}
/// <summary>
/// Executes the <see cref="ActionFunc"/>.
/// </summary>
/// <param name="command">Command.</param>
public void Call(List<string> command) {
ActionFunc(command);
}
}
}