示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (lever0.getIsActive())
        {
            doorIsOpen = true;
        }

        // If solution is invalidated, door closes again.
        if (!lever0.getIsActive() && doorIsOpen)
        {
            doorIsOpen = false;
        }

        // Notifies player when they have successfully opened the gate
        StartCoroutine(NotifyOpenGate());

        if (notifyOpen)
        {
            notificationText.enabled = true;
        }
        else
        {
            notificationText.enabled = false;
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        // Solution: 100110

        if (lever0.getIsActive() && !lever1.getIsActive() && !lever2.getIsActive() && lever3.getIsActive() && lever4.getIsActive() && !lever5.getIsActive() && !doorIsOpen)
        {
            notifyOpen = true;
            doorIsOpen = true;
        }

        // If solution is invalidated, door closes again. (Opposite of solution above): 011001
        if ((!lever0.getIsActive() || lever1.getIsActive() || lever2.getIsActive() || !lever3.getIsActive() || !lever4.getIsActive() || lever5.getIsActive()) && doorIsOpen)
        {
            doorIsOpen = false;
        }

        // Notifies player when they have successfully opened the gate
        StartCoroutine(NotifyOpenGate());

        if (notifyOpen)
        {
            notificationText.enabled = true;
        }
        else
        {
            notificationText.enabled = false;
        }
    }
示例#3
0
 // Update is called once per frame
 void Update()
 {
     if (interactState.getIsActive())
     {
         MoveOrb();
     }
 }
示例#4
0
    private void FixedUpdate()
    {
        RaycastHit hit;

        interactionRay = camera.ScreenPointToRay(Input.mousePosition);

        // Checks if there is an object in front of the player and sets a boolean accordingly
        if (Physics.Raycast(interactionRay, out hit, interactDistance) && hit.transform.tag == "Interactable")
        {
            reticlePanel.SetActive(true);
            isInteractionAvailable   = true;
            interactControls.enabled = true;
            //Debug.Log("INTERACTING");
        }
        else // if (!Physics.Raycast(interactionRay, out hit, interactDistance))
        {
            reticlePanel.SetActive(true);
            isInteractionAvailable   = false;
            interactControls.enabled = false;
            //Debug.Log("NOT INTERACTING");
        }

        // Checks whether above boolean is true and the Interact button (Left Click) is pressed down.
        // If both are true, it sets the state of the interactable object as
        // the opposite of it's previous state. (False if true, true if false)
        if (Input.GetButtonDown("Interact") && isInteractionAvailable)
        {
            InteractionState state = hit.collider.GetComponent <InteractionState>();
            if (state != null && !state.getIsActive())
            {
                state.setIsActive(true);
                Debug.Log("Interacted With! Set to: " + state.getIsActive());
            }
            else if (state != null && state.getIsActive())
            {
                state.setIsActive(false);
                Debug.Log("Interacted With! Set to: " + state.getIsActive());
            }
        }
    }
示例#5
0
 private void Update()
 {
     isActive = interactState.getIsActive();
     if (isActive == true && inDialogue == false)
     {
         inDialogue = true;
         StartDialogue();
     }
     if (inDialogue == true)    //sets the object this script is attached to, to destroy itself
     {
         Destroy(gameObject);
     }
 }