예제 #1
0
    void FixedUpdate()
    {
        //update the state of our current input's modifiers.
        if (ci == null)
        {
            return;
        }

        ci.shift = (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift));
        ci.ctrl  = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl));
        ci.alt   = (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt));

        //check all possible keys for input
        foreach (KeyCode vKey in keyCodeList)
        {
            if (keysToIgnore.Contains(vKey))
            {
                continue;
            }

            ci.key = vKey;
            if (binding)
            {
                if (mouseDown && vKey == KeyCode.Mouse0)
                {
                    if (Input.GetKeyUp(vKey))
                    {
                        mouseDown = false;
                    }

                    continue;
                }

                if (Input.GetKey(vKey) && vKey != KeyCode.Mouse0)
                {
                    textToBind.text = ci.ToString();
                }
                if (Input.GetKeyUp(vKey))
                {
                    bind(ViewOfAction(groupToBind[0]), ci.Copy(), groupToBind);
                }
                continue;
            }

            StateManager.View oldState = state.gameView;
            checkKeymap(state.gameView);
            if (oldState != StateManager.View.Global && state.gameView != StateManager.View.Global)
            {
                checkKeymap(StateManager.View.Global);
            }
        }
    }