Exemplo n.º 1
0
        public object Get(string name, params object[] objects)
        {
            if (_keybindHost == null)
            {
                return(null);
            }
            if (!_keybindHost._actions.ContainsKey(name))
            {
                return(null);
            }

            GameKeybind keybind = _keybindHost._actions[name];

            GameKeybindContext context = new GameKeybindContext()
            {
                Actor = this,
                Host  = _keybindHost,

                ActorParameter    = Parameter,
                InstanceParameter = objects,

                KeyboardState   = Keyboard.GetState(),
                MouseState      = Mouse.GetState(),
                ControllerState = Controller?.GetState() ?? new GameControllerState(true),
            };

            return(keybind[Type].Invoke(context));
        }
Exemplo n.º 2
0
        public void Setup(string name, Func <GameKeybindContext, object> keyboard = null, Func <GameKeybindContext, object> gameController = null, Func <GameKeybindContext, object> ai = null)
        {
            GameKeybind bind;

            if (_actions.ContainsKey(name))
            {
                bind = _actions[name];
            }
            else
            {
                bind = new GameKeybind();
                _actions.Add(name, bind);
            }

            bind.Keyboard   = keyboard;
            bind.Controller = gameController;
            bind.AI         = ai;
        }