Moar Gamecraft commands!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1KB

  1. using System;
  2. using RobocraftX.GUI.CommandLine;
  3. using RobocraftX.Multiplayer;
  4. using RobocraftX.StateSync;
  5. using RobocraftX.Character;
  6. using Svelto.ECS;
  7. using Unity.Entities;
  8. using UnityEngine;
  9. using uREPL;
  10. using Svelto.Context;
  11. using RobocraftX;
  12. namespace ExtraCommands.Basics
  13. {
  14. [CustomCommand("SetTargetFPS")]
  15. class SetTargetFramerateCommandEngine : CustomCommandEngine
  16. {
  17. public SetTargetFramerateCommandEngine(UnityContext<FullGameCompositionRoot> ctxHolder, EnginesRoot enginesRoot, World physW, Action reloadGame, MultiplayerInitParameters mpParams) : base(ctxHolder, enginesRoot, physW, reloadGame, mpParams)
  18. {
  19. }
  20. public override void Ready()
  21. {
  22. CustomCommandUtility.Register<int>("SetTargetFPS", SetFramerateCommand, "Set Gamecraft's target FPS");
  23. }
  24. private void SetFramerateCommand(int newFoV)
  25. {
  26. Application.targetFrameRate = newFoV;
  27. }
  28. public override void Dispose()
  29. {
  30. CustomCommandUtility.Unregister("SetTargetFPS");
  31. }
  32. }
  33. }