Exemplo n.º 1
0
 public void EnableMouse(bool TurnOn)
 {
     if (TurnOn)
     {
         FPC.enabled      = false;
         Cursor.visible   = true;
         Cursor.lockState = CursorLockMode.None;
     }
     else
     {
         FPC.enabled      = true;
         Cursor.visible   = false;
         Cursor.lockState = CursorLockMode.Locked;
         QuestionPanel.SetActive(false);
         AnswerPanel.SetActive(false);
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        float CloseDistance = 100000f;
        int   Subject       = 0;

        for (int i = 0; i < Triggers.Length; i++) // i = Counter.
        {
            float thisDistance = Vector3.Distance(Triggers[i].transform.position, Player.transform.position);
            // If current distance is less that close distance, then close distance will be the new current distance.
            if (thisDistance < CloseDistance)
            {
                CloseDistance = thisDistance;
                Subject       = i;
            }
        }
        // Checks if the Player enters the close distance of the Trigger box.
        if (CloseDistance < TriggerDistance)
        {
            if (!isUIDisplaying)
            {
                HintPanel.SetActive(true); // If the Player enters this TriggerDistance, then activate Hint Panel from Unity.

                if (Input.GetKey("e"))
                {
                    QsAs(Subject);              // Call the functions.
                    isUIDisplaying = true;      // Calls the boolean.
                    EnableMouse(true);          // Enable the mouse.
                    HintPanel.SetActive(false); // Disable the Hint Panel when the Player presses E.
                }
            }
        }
        // Otherwise, checks if the Player left the close distance.
        else
        {
            HintPanel.SetActive(false);

            if (isUIDisplaying)
            {
                QuestionPanel.SetActive(false);
                AnswerPanel.SetActive(false);
                isUIDisplaying = false;
                EnableMouse(false);
            }
        }
    }
Exemplo n.º 3
0
    public void As(int Rep)
    {
        QuestionPanel.SetActive(false);
        AnswerPanel.SetActive(true);
        switch (Rep)
        {
        case 0:
            Reply.text = Answers[Answer0];
            break;

        case 1:
            Reply.text = Answers[Answer1];
            break;

        case 2:
            Reply.text = Answers[Answer2];
            break;
        }
    }
Exemplo n.º 4
0
 public void GoBack(int X)
 {
     QuestionPanel.SetActive(true);
     AnswerPanel.SetActive(false);
 }