-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommands_Base.cs
More file actions
31 lines (28 loc) · 928 Bytes
/
Commands_Base.cs
File metadata and controls
31 lines (28 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Linq;
using UnityEngine;
namespace Steelbox.Console.Commands
{
public static class Commands_Base
{
[ConsoleCommand("help", "List all available commands")]
public static string Help(string[] args)
{
var lines = ConsoleManager.Instance.CommandMetadata
.Select(kvp => $"- {kvp.Key}: {kvp.Value.Description}")
.OrderBy(x => x)
.ToArray();
return string.Join("\n", lines);
}
[ConsoleCommand("time-scale", "Set the game time scale")]
public static string TimeScale(string[] args)
{
if (args.Length is > 1 or 0) return "tooManyArguments";
if (float.TryParse(args[0], out float timeValue))
{
Time.timeScale = timeValue;
return "successful";
}
return string.Empty;
}
}
}