Esempio n. 1
0
    void Update()
    {
        foreach (StandardControls control in controls)
        {
            StandardKeyCodes key = KeyMappings.controlToKey(control);

            long downTime = inputManager.GetKeyDown(key);
            if (downTime >= 0)
            {
                OnKeyDown(key, downTime);
            }
            long upTime = inputManager.GetKeyUp(key);
            if (upTime >= 0)
            {
                OnKeyUp(key, upTime);
            }
        }


                #if UNITY_IOS
        //mobile only
        foreach (StandardControls control in controls)
        {
            StandardKeyCodes key = KeyMappings.controlToKey(control);

            long downTime = mobileInput.keyDown(key);
            if (downTime >= 0)
            {
                OnKeyDown(key, downTime);
            }
            long upTime = mobileInput.keyUp(key);
            if (upTime >= 0)
            {
                OnKeyUp(key, upTime);
            }
        }
                #endif


        //WARN: This code is far more complex then it has to be
        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (!patternMaster.isPlaying())
            {
                //order matters here. Once invoke is called, paused may be modified
                bool paused = patternMaster.isPaused();

                Messenger.Invoke(MessengerKeys.TOGGLE_MENU);

                if (paused)
                {
                    ResumeGame();
                }
                else
                {
                    BeginGame();
                }
            }
        }
        ;
    }