Exemplo n.º 1
0
    void OnGUI()
    {
        GUI.skin   = style;
        oldMatrix  = GUI.matrix;
        GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, GeneralRessources.Scale);

        if (GUI.Button(buttonPosition, content, style.customStyles [0]))
        {
            drunkenness += 0.1f;

            // Kill all challenges
            foreach (Challenge ch in FindObjectsOfType <Challenge> ())
            {
                ArtObject ao = GalleryVisitor.GetClosestArtwork(transform.position);
                if (ch.victim == gameObject.GetComponent <GalleryVisitor> () && ch.topic == ao)
                {
                    Destroy(ch.gameObject);
                }
            }

            // Go to another place

            if (drink != null)
            {
                GetComponent <AudioSource> ().PlayOneShot(drink);
            }
            GetComponentInChildren <Animator> ().SetTrigger("pDrink");
            GetComponent <ParticleSystem> ().Play();
            StartCoroutine(Teleport());
        }

        GUI.matrix = oldMatrix;
    }
Exemplo n.º 2
0
    void OnGUI()
    {
        if (!GetComponent <GalleryVisitor> ().CanTalk())
        {
            return;
        }

        GUI.skin = skin;

        // Setup GUI scaling
        oldMatrix  = GUI.matrix;
        GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, GeneralRessources.Scale);

        //Show list
        GUILayout.BeginArea(positionOfList);
        GUILayout.BeginScrollView(scrollViewPosition);
        foreach (Statement item in inventory)
        {
            if (GUILayout.Button(item.text))
            {
                ArtObject talkedAboutArtwork = gv.GetClosestArtwork();
                Statement st = item;
                if (GetComponent <Champagne> ().doNonsense())
                {
                    st = inventory[Random.Range(0, inventory.Count)];
                    GetComponent <ParticleSystem> ().Play();
                }
                GetComponent <StatementMaker> ().State(st.property, talkedAboutArtwork, st.opinion);
            }
        }
        GUILayout.EndScrollView();
        GUILayout.EndArea();

        // Reset GUI scaling
        GUI.matrix = oldMatrix;
    }