Exemplo n.º 1
0
        public KeyboardBehaviour()
        {
            keyBindings = new SortedList<Keys, KeyBinding>();
            KeyBinding[] keyArray = new KeyBinding[] {
                 new KeyBinding(KeyAction.MoveForward,Keys.W, MoveForward),
                new KeyBinding(KeyAction.MoveBackward, Keys.S, MoveBackard),
                new KeyBinding(KeyAction.StrafeLeft, Keys.A, MoveLeft),
                new KeyBinding(KeyAction.StrafeRight, Keys.D, MoveRight)
            };

            foreach (KeyBinding kb in keyArray)
                this.keyBindings.Add(kb.Key, kb);
            actions = new bool[keyBindings.Count()];
        }
Exemplo n.º 2
0
 public void SetBinding(KeyBinding binding)
 {
     if (!keyBindings.ContainsKey(binding.Key))
         keyBindings.Add(binding.Key, binding);
 }