Exemple #1
0
 public void ResetLevers()
 {
     lever0.setIsActive(false);
     lever1.setIsActive(false);
     lever2.setIsActive(false);
     lever3.setIsActive(false);
     lever4.setIsActive(false);
     lever5.setIsActive(false);
 }
Exemple #2
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());
            }
        }
    }
Exemple #3
0
    public void ResetLevers()
    {
        foreach (GameObject lever in levers)
        {
            lever.GetComponent <AudioSource>().enabled = false;
        }

        lever0.setIsActive(false);

        foreach (GameObject lever in levers)
        {
            lever.GetComponent <AudioSource>().enabled = true;
        }
    }
Exemple #4
0
 public void ResetLevers()
 {
     lever0.setIsActive(false);
 }