public DebugComponent(GameState State) : base(State) { this.DrawOrder = int.MaxValue; this.Font = CorvusGame.Instance.GlobalContent.Load<SpriteFont>("Fonts/TestFont"); if(Directory.Exists(DATA_FOLDER_PATH)) { FileSystemWatcher fsw = new FileSystemWatcher(DATA_FOLDER_PATH); fsw.InternalBufferSize = 1024 * 256; fsw.IncludeSubdirectories = true; fsw.Changed += DataFileUpdate; fsw.Created += DataFileUpdate; fsw.EnableRaisingEvents = true; } SceneManager = CorvusGame.Instance.SceneManager; CorvusGame.Instance.Game.IsMouseVisible = true; this.Player = (CorvusPlayer)CorvusGame.Instance.Players.First(); Bind ReloadLevelsBind = new Bind(Player.InputManager, ReloadPressed, false, Keys.F5); Player.InputManager.RegisterBind(ReloadLevelsBind); Bind ClearCameraBind = new Bind(Player.InputManager, ClearCameraPressed, false, Keys.F12); Player.InputManager.RegisterBind(ClearCameraBind); Bind ToggleGeometryBind = new Bind(Player.InputManager, ToggleGeometryPressed, false, Keys.F11); Player.InputManager.RegisterBind(ToggleGeometryBind); Bind ToggleEntityBind = new Bind(Player.InputManager, ToggleEntityPressed, false, Keys.F10); Player.InputManager.RegisterBind(ToggleEntityBind); Bind TogglePerformanceBind = new Bind(Player.InputManager, TogglePerformancePressed, false, Keys.F9); Player.InputManager.RegisterBind(TogglePerformanceBind); CurrentCamera = Player.Character.GetComponent<ChaseCameraComponent>(); GeometryTexture = CorvusGame.Instance.GlobalContent.Load<Texture2D>("Interface/Outline"); }
/// <summary> /// Removes the specified bind from being managed by this InputManager. /// </summary> public void RemoveBind(Bind Bind) { bool Result = this._Binds.Remove(Bind); if(!Result) throw new KeyNotFoundException(); }
/// <summary> /// Adds the specified bind to be managed by this InputManager. /// </summary> public void RegisterBind(Bind Bind) { this._Binds.Add(Bind); }
private void Assign(Action<BindState> Action, bool MultiInvoke, params InputButton[] Buttons) { Bind Bind = new Bind(_Player.InputManager, Action, MultiInvoke); foreach(var Button in Buttons) { Bind.RegisterButton(Button); } _Binds.Add(Bind); _Player.InputManager.RegisterBind(Bind); }