示例#1
0
    // check if player switches targets or attacks
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.BackQuote)) // toggle pause
        {
            setPause(!pause);
        }
        if (pause)
        {
            return;
        }
        int old_ind = field.target_ind;

        //TARGET RETICULE CODE

        // move target left or right
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            --field.target_ind;
        }
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            ++field.target_ind;
        }

        // third eye stuff
        if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift) && !thirdEyeActive)
        {
            startThirdEye();
        }
        if ((Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift)) && thirdEyeActive)
        {
            stopThirdEye();
        }
        if (!thirdEyeActive)
        {
            currThirdEyeCharge = Mathf.Min(currThirdEyeCharge + 0.03f, maxThirdEyeCharge);
        }
        debugThirdEyeCharge.text = ((currThirdEyeCharge / maxThirdEyeCharge) * 10).ToString();
        // fix if target is out of bounds
        if (field.target_ind < 0)
        {
            field.target_ind = 0;
        }
        if (field.target_ind > 2)
        {
            field.target_ind = 2;
        }
        // check if target was actually moved
        if (old_ind != field.target_ind)
        {
            uiManager.setTarget(field.target_ind);
        }
        //SPELLBOOK CODE

        // go to next page if down is pressed
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            if (castManager.pageDown())
            {
                AudioPlayer.main.playSFX("sfx_spellbook_scroll", 0.3F);
            }
            //else {play sfx_thud (player is on the last page this direction)}
        }
        // go to last page if down is pressed
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            if (castManager.pageUp())
            {
                AudioPlayer.main.playSFX("sfx_spellbook_scroll", 0.3F);
            }
            //else {play sfx_thud (player is on the last page this direction)}
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            AudioPlayer.main.playSFX("sfx_backspace");
            trackTyping.revertBuffer();
        }

        /*if (Input.GetKeyDown(KeyCode.Alpha1))
         * {
         *  startFrenzyCast();
         * }*/
    }