상속: InputKey
예제 #1
0
        private InputManager(Game game)
            : base(game)
        {
            KHit = new Key();
            KHit.SetActivator(KeyboardDefault_Hit);
            KJump = new Key();
            KJump.SetActivator(KeyboardDefault_Jump);
            KInteract = new Key();
            KInteract.SetActivator(KeyboardDefault_Interact);
            KUsePotion = new Key();
            KUsePotion.SetActivator(KeyboardDefault_UsePotion);
            KInventory = new Key();
            KInventory.SetActivator(KeyboardDefault_Inventory);
            KQuit = new Key();
            KQuit.SetActivator(KeyboardDefault_Quit);

            KMove = new DirectionInput();
            KMove.SetActivator(KeyboardDefault_Move);

            _inputList.Add(KHit);
            _inputList.Add(KJump);
            _inputList.Add(KInteract);
            _inputList.Add(KUsePotion);
            _inputList.Add(KMove);
            _inputList.Add(KInventory);
            _inputList.Add(KQuit);

            foreach (InputKey ik in _inputList)
            {
                ik.SetMode(_defaultMode);
            }
        }
예제 #2
0
 public void Unsubscribe(Key key, ref EventHandler handler)
 {
     key.Pressed -= handler;
 }
예제 #3
0
 public void Subscribe(Key key, ref EventHandler handler)
 {
     key.Pressed += handler;
 }
예제 #4
0
 public void RegisterKey(String name, Buttons binding)
 {
     Key k = new Key();
     k.SetActivator(binding);
     _keys.Add(name, k);
 }