Ejemplo n.º 1
0
    IEnumerator fakeFeed()
    {
        chatterOpen = true;
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        transform.position = player.transform.position;
        transform.rotation = player.transform.rotation;

        for (int i = 0; i < 15; i++)
        {
            int   panelNum = i / 3;
            int   itemNum  = i % 3;
            float offset   = Random.Range(-0.03f, 0.03f);

            yield return(new WaitForSeconds(chatterWaitTime));

            GameObject obj = (GameObject)Instantiate(Resources.Load("Chatter Item"));
            obj.transform.SetParent(panels[panelNum].transform);
            ChatterItem newItem = obj.GetComponent <ChatterItem>();
            newItem.init(i);

            obj.transform.localPosition = new Vector3(offset, 0.35f - (itemNum * 0.29f) + (offset / 10f), offset);
            obj.transform.localScale    = new Vector3(0.07f, 0.07f, 0.07f);
            obj.transform.localRotation = Quaternion.identity;

            newItem.GetComponent <Animator>().Play("Chatter Item Open");
            newItem.GetComponent <AudioSource>().Play();
        }
    }
Ejemplo n.º 2
0
    IEnumerator popinFeed()
    {
        yield return(new WaitForSeconds(0.5f));

        int num = 0;

        chatterOpen           = true;
        raycaster.chatterOpen = true;
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        transform.position = player.transform.position;
        transform.rotation = player.transform.rotation;

        foreach (JSONValue row in chatterArray)
        {
            int   panelNum = num / 3;
            int   itemNum  = num % 3;
            float offset   = Random.Range(-0.03f, 0.03f);

            yield return(new WaitForSeconds(chatterWaitTime));

            JSONObject rec = JSONObject.Parse(row.ToString());
            GameObject obj = (GameObject)Instantiate(Resources.Load("Chatter Item"));
            obj.transform.SetParent(panels[panelNum].transform);
            ChatterItem newItem = obj.GetComponent <ChatterItem>();
            newItem.initMain(rec, this);

            obj.transform.localPosition = new Vector3(offset, 0.35f - (itemNum * 0.29f) + (offset / 10f), offset);
            obj.transform.localScale    = new Vector3(0.07f, 0.07f, 0.07f);
            obj.transform.localRotation = Quaternion.identity;

            newItem.GetComponent <Animator>().Play("Chatter Item Open");
            newItem.GetComponent <AudioSource>().Play();

            num++;
        }

        GameObject[] items = GameObject.FindGameObjectsWithTag("Chatter Item");
        foreach (GameObject item in items)
        {
            ChatterItem chatterItem = item.GetComponent <ChatterItem>();
            chatterItem.getPhoto();

            while (!chatterItem.photoRetrieved)
            {
                yield return(new WaitForSeconds(0.1f));
            }
        }
    }