예제 #1
0
    void Update()
    {
        if (Input.GetKeyDown(player_nexttrapkey))
        {
            int newtrapindex = m_trapmanager.GetNextTrap(m_selectedtrap);

            if (newtrapindex != m_selectedtrap)
            {
                m_trapmanager.GetTrap(m_selectedtrap).UseThisTrap(false);
                m_trapmanager.GetTrap(newtrapindex).UseThisTrap(true);

                m_selectedtrap = newtrapindex;
            }
        }

        if (Input.GetKeyDown(player_previoustrapkey))
        {
            int newtrapindex = m_trapmanager.GetPreviousTrap(m_selectedtrap);

            if (newtrapindex != m_selectedtrap)
            {
                m_trapmanager.GetTrap(m_selectedtrap).UseThisTrap(false);
                m_trapmanager.GetTrap(newtrapindex).UseThisTrap(true);

                m_selectedtrap = newtrapindex;
            }
        }

        transform.position = m_activationposition[m_selectedtrap].position;

        if (m_trapmanager.GetTrap(m_selectedtrap).PlayerMayPress())
        {
            if (Input.GetKeyDown(player_activatetrapkey))
            {
                m_trapmanager.ActivateTrap(m_selectedtrap);
            }
        }
    }