コード例 #1
0
    void OnGUI()
    {
        int stringWidth  = 150;
        int stringHeight = 50;

        if (canOpenRiddle && !emergencyCard.GetCanAnswerToRiddle() && !canvas.isActiveAndEnabled)
        {
            GUI.Label(new Rect(Screen.width / 2 - (stringWidth / 2), Screen.height / 2, stringWidth, stringHeight), "Find Key Card", colorOfText);
        }
        else if (canOpenRiddle && emergencyCard.GetCanAnswerToRiddle() && !canvas.isActiveAndEnabled)
        {
            GUI.Label(new Rect(Screen.width / 2 - (stringWidth / 2), Screen.height / 2, stringWidth, stringHeight), "Press Left Mouse button", colorOfText);
        }
    }
コード例 #2
0
 void OnTriggerStay(Collider other)
 {
     if (other.tag == "Computer")
     {
         if (emergencyCard.GetCanAnswerToRiddle() && riddle.GetCanOpenRiddle())
         {
             if (Input.GetKeyDown(KeyCode.Mouse0))
             {
                 itemDisplay.enabled = false;
                 CursorEnable();
                 riddleCanvas.enabled    = true;
                 playerControler.enabled = false;
                 itemsPickUp.enabled     = false;
             }
             if (Input.GetKeyDown(KeyCode.Escape))
             {
                 itemDisplay.enabled = true;
                 CursorDisable();
                 riddleCanvas.enabled    = false;
                 playerControler.enabled = true;
                 itemsPickUp.enabled     = true;
             }
         }
     }
 }