public void Interact()
    {
        Transform player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();

        if (open)
        {
            Close();
            Debug.Log("Close local");
            if (linkedDoorActive != null)
            {
                Debug.Log("Linked not null: " + linkedDoorActive.ID);
                linkedDoorActive.Close();
            }
        }
        else
        {
            clockwise        = Vector3.Dot(player.position - transform.position, transform.right) > 0;
            linkedDoorActive = clockwise ? linkedDoorClockwise : linkedDoorAnticlockwise;

            Open();

            if (linkedDoorActive != null)
            {
                linkedDoorActive.clockwise        = clockwise;
                linkedDoorActive.linkedDoorActive = clockwise ? linkedDoorActive.linkedDoorClockwise : linkedDoorActive.linkedDoorAnticlockwise;
                linkedDoorActive.Open();
            }
        }
    }
Example #2
0
    //! Actions for when the State starts.

    /*! Set the Camera inside the state to be Active, overlaying the Main Camera used at InGameState,
     * does the animation to open the cupboard left door and enable the UI Canvas. */
    public override void OnStartRun()
    {
        //GameObject.Find ("Journal").GetComponent<JournalController> ().checkJournalItem (0);
        cameraState.gameObject.SetActive(true);
        HudText.SetText("");
        leftDoor.Open();
        canvasUI.GetComponent <Canvas>().enabled = true;

        //UIScrollList.transform.parent.GetComponent<ScrollRect>().verticalScrollbar.value = 1;
    }
    //! Actions for when the State starts.

    /*! Set the Camera inside the state to be Active, overlaying the Main Camera used at InGameState,
     * does the animation to open the cupboard left door and enable the UI Canvas. */
    public override void OnStartRun()
    {
        cameraState.gameObject.SetActive(true);
        HudText.SetText("");

        leftDoor.Open();
        canvasUI.GetComponent <Canvas>().enabled = true;

        //UIScrollList.transform.parent.GetComponent<ScrollRect>().verticalScrollbar.value = 1;
    }