Ejemplo n.º 1
0
    /// <summary>
    /// Used when code is typed corectly
    /// </summary>
    public void ButtonInteract()
    {
        codeUI.SetActive(false);
        Cursor.lockState        = CursorLockMode.Locked;
        Cursor.visible          = false;
        sterowanie.active       = true;
        playerRigid.constraints = RigidbodyConstraints.FreezeRotation;

        backupButton.Interact();
        backupButton = null;
    }
Ejemplo n.º 2
0
    //Button:
    void ButtonCheck(MAIPA.Interactable.Button btn)
    {
        if (btn.isItemNeeded)
        {
            bool isId = false;
            foreach (var id in btn.itemIds)
            {
                if (choosedItemID == id)
                {
                    isId = true;
                    break;
                }
            }

            if (isId)
            {
                if (btn.isCoded)
                {
                    codeUI.SetActive(true);
                    Cursor.lockState  = CursorLockMode.None;
                    Cursor.visible    = true;
                    sterowanie.active = false;
                    time = betweenInputs;
                    playerRigid.constraints = RigidbodyConstraints.FreezeAll;
                    playerState             = PlayerState.Decoding;


                    codeHandler.codeType = btn.codeType;
                    if (btn.codeType == CodeType.TEXT_CODE)
                    {
                        codeHandler.SetTextCode(btn.textCode);
                    }
                    else if (btn.codeType == CodeType.NUM_CODE)
                    {
                        codeHandler.SetNumCode(btn.num1, btn.num2, btn.num3, btn.num4);
                    }
                    codeHandler.UpdateUI();
                    backupButton = btn;
                }
                else
                {
                    btn.Interact();
                }
            }
            else
            {
                if (!itemIsNeededText.activeSelf)
                {
                    itemIsNeededText.SetActive(true);
                }
                else
                {
                    itemIsNeededText.SetActive(false);
                    itemIsNeededText.SetActive(true);
                }
            }
        }
        else
        {
            if (btn.isCoded)
            {
                codeUI.SetActive(true);
                Cursor.lockState  = CursorLockMode.None;
                Cursor.visible    = true;
                sterowanie.active = false;
                time = betweenInputs;
                playerRigid.constraints = RigidbodyConstraints.FreezeAll;
                playerState             = PlayerState.Decoding;


                codeHandler.codeType = btn.codeType;
                if (btn.codeType == CodeType.TEXT_CODE)
                {
                    codeHandler.SetTextCode(btn.textCode);
                }
                else if (btn.codeType == CodeType.NUM_CODE)
                {
                    codeHandler.SetNumCode(btn.num1, btn.num2, btn.num3, btn.num4);
                }
                codeHandler.UpdateUI();
                backupButton = btn;
            }
            else
            {
                btn.Interact();
            }
        }
    }