Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (m_enabled == false)
        {
            return;
        }

        if (ControllerInterface.GetKeyDown("start"))
        {
            m_enabled = false;
            ChangeScene();
        }
    }
Пример #2
0
    void UpdateSelector()
    {
        //First pass
        if (m_selector == -1)
        {
            m_selector = 0;
        }

        if (ControllerInterface.GetKeyDown("right"))
        {
            m_selector++;
            lockSelectionTimer += lockSelectionDelay;
        }
        else if (ControllerInterface.GetKeyDown("left"))
        {
            m_selector--;
            lockSelectionTimer += lockSelectionDelay;
        }
        else if (ControllerInterface.GetKeyDown("down"))
        {
            foreach (VirtualSelector selector in m_currentSelectables)
            {
                selector.DownAction();
            }
            lockSelectionTimer += lockSelectionDelay;
            if (m_selector == 2)
            {
                m_playersCounter--;
                m_playersCounter = Mathf.Clamp(m_playersCounter, 2, 4);
                PlayersText.text = m_playersCounter.ToString();
            }
        }
        else if (ControllerInterface.GetKeyDown("up"))
        {
            foreach (VirtualSelector selector in m_currentSelectables)
            {
                selector.UpAction();
            }
            lockSelectionTimer += lockSelectionDelay;
            if (m_selector == 2)
            {
                m_playersCounter++;
                m_playersCounter = Mathf.Clamp(m_playersCounter, 2, 4);
                PlayersText.text = m_playersCounter.ToString();
            }
        }
        else if (ControllerInterface.GetKeyDown("validate"))
        {
            if (m_selector == 3)
            {
                StartGame();
            }
            lockSelectionTimer += lockSelectionDelay;
        }

        if (m_selector > m_maxSelectables)
        {
            m_selector = 0;
        }

        if (m_selector < 0)
        {
            m_selector = m_maxSelectables;
        }
    }