Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     age += Time.deltaTime;
     if (!textDisplayed)
     {
         Listeners ls = GetComponent <Listeners> ();
         if (ls.found)
         {
             GalleryVisitor pgv = GameObject.FindWithTag("Player").GetComponent <GalleryVisitor> ();
             if (ls.listeners.Contains(pgv))
             {
                 text                 = property.ToString() + "!";
                 textmesh.text        = text;
                 transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
                 iTween.PunchScale(this.gameObject, new Vector3(1.1f, 1.1f, 1.0f), 0.5f);
             }
             else
             {
                 text                 = "...";
                 textmesh.text        = "...";
                 transform.localScale = new Vector3(0.67f, 0.67f, 1.0f);
             }
             textDisplayed = true;
         }
     }
 }
Exemplo n.º 2
0
    public void Init(ArtProperties property, GalleryVisitor emitter, ArtObject topic, bool opinion)
    {
        this.property      = property;
        this.emitter       = emitter;
        this.topic         = topic;
        this.opinion       = opinion;
        transform.position = emitter.transform.position + offset;
        text                 = "Hmm...";
        textmesh             = this.gameObject.GetComponentInChildren <TextMesh> ();
        textmesh.text        = "Hmm...";
        transform.localScale = new Vector3(0.0f, 0.0f, 1.0f);

        repeat = topic.lastPropertyStated == property;
        topic.lastPropertyStated = property;

        foreach (Challenge ch in FindObjectsOfType <Challenge> ())
        {
            if (ch.victim == emitter && ch.topic == topic)
            {
                Destroy(ch.gameObject);
            }
        }

        if (opinion)
        {
            emitter.GetComponent <Speaker> ().playGood();
        }
        else
        {
            emitter.GetComponent <Speaker> ().playBad();
        }

        textmesh.gameObject.renderer.sortingLayerID = 3;
    }
Exemplo n.º 3
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.º 4
0
    void Start()
    {
        gv = GetComponent <GalleryVisitor> ();

        // Get GUIskin
        skin = Camera.main.GetComponent <GeneralRessources> ().Style;
    }
Exemplo n.º 5
0
 ArtObject nearbyArt(GalleryVisitor pgv)
 {
     foreach (ArtObject ao in FindObjectsOfType <ArtObject> ())
     {
         if ((transform.position - ao.transform.position).sqrMagnitude <= maxArtDist * maxArtDist &&
             (pgv.transform.position - ao.transform.position).sqrMagnitude <= maxArtDist * maxArtDist)
         {
             return(ao);
         }
     }
     return(null);
 }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (!GetComponent <GalleryVisitor> ().CanTalk() || FindObjectOfType <Challenge> () != null)
        {
            return;
        }

        GalleryWanderer gw = GetComponent <GalleryWanderer> ();
        GalleryVisitor  gv = GetComponent <GalleryVisitor> ();

        if (gw.IsMoving())
        {
            return;
        }

        GalleryVisitor pgv = GameObject.FindWithTag("Player").GetComponent <GalleryVisitor> ();

        if (gv.reputation > pgv.reputation + maxMoreReputation)
        {
            return;
        }

        if (Random.Range(0.0f, 1.0f) > Time.deltaTime * askChancePerSecond)
        {
            return;
        }

        if ((transform.position - pgv.transform.position).sqrMagnitude <= maxPlayerDist * maxPlayerDist)
        {
            ArtObject ao = nearbyArt(pgv);
            if (ao != null)
            {
                GetComponent <Speaker> ().playAsk();
                GameObject cho = (GameObject)Instantiate(challengePrefab);
                cho.GetComponent <Challenge>().Init(ao, pgv);
                cho.transform.position = transform.position;
                gw.WaitUntilMove(cho.GetComponent <Challenge>().remainingTime);
            }
        }
    }
Exemplo n.º 7
0
    void Respond(Statement st)
    {
        int response = 0;

        if (st.opinion == GetComponent <Opinionated> ().opinions [st.topic])
        {
            response = correctOpinionBonus;
        }
        else
        {
            response = incorrectOpinionMalus;
        }

        if (st.repeat)
        {
            response += repeatMalus;
        }

        if (!st.topic.goodProperties.Contains(st.property) && !st.topic.badProperties.Contains(st.property))
        {
            response += irrelevantMalus;
        }

        if (response > 0)
        {
            GetComponent <Speaker> ().playAgree();
        }
        else
        {
            GetComponent <Speaker> ().playDisagree();
        }

        GalleryVisitor gv = GetComponent <GalleryVisitor> ();

        if (gv.reputation > st.emitter.reputation)
        {
            st.emitter.ChangeReputation(response);
        }
    }
Exemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        if (GetComponent <GalleryWanderer> ().IsMoving())
        {
            return;
        }
        GalleryVisitor gv = GetComponent <GalleryVisitor> ();

        Statement[] sts = FindObjectsOfType <Statement> ();
        foreach (Statement st in sts)
        {
            if (st.emitter != gv &&
                st.age >= responseDelay &&
                st.GetComponent <Listeners> ().listeners.Contains(gv) &&
                !st.hasReacted.Contains(gv))
            {
                st.hasReacted.Add(gv);
                Respond(st);
                break;
            }
        }
    }
Exemplo n.º 9
0
	public void Init(ArtObject topic, GalleryVisitor victim) {
		this.topic = topic;
		this.victim = victim;
	}
Exemplo n.º 10
0
 void Start()
 {
     // Get reference to gallery visitor
     visitor = GetComponent <GalleryVisitor> ();
 }