public void PickUpKey()
    {
        fxSource.Play();
        Destroy(gameObject, 0.5f);
        DisplayInventoryController display = GameObject.Find("InventoryPanel").GetComponent <DisplayInventoryController> ();

        display.DisplayOnInventory(this.index);

        DialoguesController msgsController = GameObject.Find("DialoguesController").GetComponent <DialoguesController> ();

        if (this.index == 0 || this.index == 3 || this.index == 4 || this.index == 6)
        {
            msgsController.DisplayMessage(10);
        }
        else if (this.index == 1)
        {
            msgsController.DisplayMessage(13);
        }
        else if (this.index == 2)
        {
            msgsController.DisplayMessage(11);
        }
        else if (this.index == 5)
        {
            msgsController.DisplayMessage(12);
        }
        else if (this.index == 7)
        {
            msgsController.DisplayMessage(14);
        }
    }
Esempio n. 2
0
    public void SendLightMessage()
    {
        DialoguesController message = GameObject.Find("DialoguesController").GetComponent <DialoguesController> ();

        message.DisplayMessage(15);
        fx.Play();
    }
Esempio n. 3
0
    void DeactivatePuzzle()
    {
        //active = false;
        blocker.SetActive(false);
        key.SetActive(true);
        door.OpenDoor();

        //AudiosController audioC = GameObject.Find ("AudiosController").GetComponent<AudiosController> ();
        DialoguesController dialogue = GameObject.Find("DialoguesController").GetComponent <DialoguesController> ();

        dialogue.DisplayMessage(9);
        //audioC.DesactivateBasementSound ();
    }
Esempio n. 4
0
    public void ActivePuzzle()
    {
        //active = true;
        blocker.SetActive(true);
        door.CloseDoor();

        //AudiosController audioC = GameObject.Find ("AudiosController").GetComponent<AudiosController> ();
        DialoguesController dialogue = GameObject.Find("DialoguesController").GetComponent <DialoguesController> ();

        dialogue.DisplayMessage(8);
        //audioC.ActivateBasementSound ();

        Invoke("DeactivatePuzzle", 10f);
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = new Ray(transform.position, transform.forward);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, interactDist))
            {
                Debug.Log(hit.collider.gameObject);

                // ------- DOORS ------- //
                if (hit.collider.CompareTag("SimpleDoors"))
                {
                    SimpleDoorController doorController = hit.collider.transform.GetComponent <SimpleDoorController> ();

                    if (doorController == null)
                    {
                        return;
                    }

                    if (InventoryController.keys [doorController.index] == false)
                    {
                        DialoguesController msgsController = GameObject.Find("DialoguesController").GetComponent <DialoguesController> ();
                        msgsController.DisplayMessage(doorController.index);
                    }

                    if (InventoryController.keys [doorController.index] == true)
                    {
                        doorController.OpenDoor();
                    }

                    Debug.DrawRay(ray.origin, ray.direction * hit.distance, Color.blue);
                }
                else

                if (hit.collider.CompareTag("DoubleDoors"))
                {
                    DoubleDoorsController doorsController = hit.collider.transform.GetComponent <DoubleDoorsController> ();

                    if (doorsController == null)
                    {
                        return;
                    }

                    if (InventoryController.keys [doorsController.index] == false)
                    {
                        DialoguesController msgsController = GameObject.Find("DialoguesController").GetComponent <DialoguesController> ();
                        msgsController.DisplayMessage(doorsController.index);
                    }

                    if (InventoryController.keys [doorsController.index] == true)
                    {
                        doorsController.OpenDoors();
                    }

                    Debug.DrawRay(ray.origin, ray.direction * hit.distance, Color.blue);
                }

                // ------- KEYS ------- //
                if (hit.collider.CompareTag("Keys"))
                {
                    InventoryController.keys[hit.collider.GetComponent <KeysController>().index] = true;
                    hit.collider.GetComponent <KeysController> ().PickUpKey();
                }

                if (hit.collider.name == "Switch")
                {
                    hit.collider.GetComponent <SwitchController> ().SendLightMessage();
                }
            }
        }
    }