void makeTwit(TweetSearchTwitterData tweetData)
    {
        GameObject clone = Instantiate(take_away, new Vector3(2, 10.0f - count * 2.5f, 0), transform.rotation) as GameObject;

        cubes.Add(clone);

        //clone.transform.Translate(new Vector3(15, 5, 15));
        clone.transform.parent = gameObject.transform;

        DynamicTexture dtex = clone.GetComponentInChildren <DynamicTexture>();

        TextMeshPro tweet = clone.GetComponentInChildren <TextMeshPro>();

        if (tweetData.profileImageUrl != "")
        {
            dtex.url = tweetData.profileImageUrl;
            dtex.Apply(false);
        }

        tweet.text = tweetData.screenName;

        count++;

        //if (count > 6)
        //{
        //    break;
        //}

        clone.transform.DOMoveX(30, 1).From().SetDelay(count / 10);
    }
Beispiel #2
0
    public void buildCubes()
    {
        //Camera camera = GetComponent<Camera>();
        //Vector3 p0 = camera.ScreenToWorldPoint(new Vector3(0, 0, camera.nearClipPlane));

        //MainController.TwitterAction -= handleAction;

        float scalar = 0.68F;// Core.Instance._settings.Kinect_area_X/100;

        int counter = 0;

        //cubes_array = new GameObject[maxY, maxX];
        cubes_array = new GameObject[maxX];

        zoom_targets = new float[8];

        zoom_targets[0] = -scalar - scalar * 6;

        zoom_targets[1] = -scalar - scalar * 4;

        zoom_targets[2] = -scalar - scalar * 2;

        zoom_targets[3] = -scalar;

        zoom_targets[4] = scalar;

        zoom_targets[5] = scalar + scalar * 2;

        zoom_targets[6] = scalar + scalar * 4;

        zoom_targets[7] = scalar + scalar * 6;

        //zoom_bool = new bool[8];

        TweetSearchTwitterData twitterData;

        int tweet_counter     = 0;
        int tweet_counter_max = MainController.Instance.TweetsList.Count;
        int tweet_index;

        for (int px = 0; px < maxX; ++px)
        {
            GameObject clone = Instantiate(rounded_cube, new Vector3(gameObject.transform.position.x, -4.0F, 10.0f), transform.rotation) as GameObject;

            clone.GetComponent <RoundedCube>().image_quad.SetActive(true);

            //ATTACH TO PARENT
            clone.transform.parent = gameObject.transform;


            //ADD TWITTER DATA TO CUBE
            tweet_index = tweet_counter + (cube_id - 1) * maxX;

            if (tweet_index >= tweet_counter_max)
            {
                tweet_counter = 0;
                tweet_index   = tweet_counter_max - 1;
            }

            twitterData = MainController.Instance.TweetsList[tweet_index];

            tweet_counter++;

            DynamicTexture dtex = clone.GetComponentInChildren <DynamicTexture>();

            Text tweet = clone.GetComponentInChildren <Text>();

            if (twitterData.tweetMedia != "")
            {
                dtex.url = twitterData.tweetMedia;
                dtex.Apply(true);
                clone.GetComponent <RoundedCube>().hasImage = true;
            }
            else
            {
                clone.GetComponent <RoundedCube>().image_quad.SetActive(false);
            }

            string text = twitterData.tweetText;

            clone.GetComponentInChildren <RoundedCube>().setTweetText(text);

            //clone.GetComponent<RoundedCube>().cube_grp.transform.Rotate(Vector3.up * 90);// Random.Range(0, 20));

            cubes_array[px] = clone;

            counter++;

            //clone.transform.DOScale(0, 0);

            //clone.SetActive(false);
        }

        INIT = true;
    }
    public void buildCubes()
    {
        MainController.TwitterAction -= handleAction;

        int   counter  = 0;
        float x_factor = 14;
        float y_factor = 3;
        float z_factor = 10;

        float noisefy = 0.5f;
        float noisefx = 7.0f;

        //float noisefy = 0f;
        //float noisefx = 0f;

        float cube_root = Mathf.Floor(Mathf.Pow(maxX, 1f / 3f));

        TweetSearchTwitterData twitterData;

        int max_count = MainController.Instance.TweetsList.Count;

        for (float x = 0; x < cube_root; ++x)
        {
            for (float y = 0; y < cube_root; ++y)
            {
                for (float z = 0; z < cube_root; ++z)
                {
                    //GameObject clone = Instantiate(rounded_cube, new Vector3(px / 2 * Random.Range(-2.0f, 2.0f), Random.Range(-5.0f, 5.0f), Random.Range(-10.0f, 30.0f)), transform.rotation) as GameObject;
                    float noisey = Random.Range(-noisefy, noisefy);
                    float noisex = Random.Range(-noisefx, noisefx);

                    GameObject clone = Instantiate(rounded_cube, new Vector3(x_factor * (x - (cube_root - 1) / 2) + noisex, y_factor * (y - (cube_root - 1) / 2) + noisey, z_factor * z), transform.rotation) as GameObject;

                    clone.GetComponent <RoundedCube>().image_quad.SetActive(true);

                    clone.GetComponent <RoundedCube>().speed = 1.0f - 1.5f * z / z_factor;

                    //clone.transform.parent = transform;
                    //ADD TWITTER DATA TO CUBE
                    if (counter >= max_count)
                    {
                        counter = 0;
                    }

                    twitterData = MainController.Instance.TweetsList[counter];

                    DynamicTexture dtex  = clone.GetComponentInChildren <DynamicTexture>();
                    Text           tweet = clone.GetComponentInChildren <Text>();

                    if (twitterData.tweetMedia != "")
                    {
                        dtex.url = twitterData.tweetMedia;
                        dtex.Apply(true);
                    }
                    else
                    {
                        clone.GetComponent <RoundedCube>().image_quad.SetActive(false);
                    }

                    string text = twitterData.tweetText;

                    clone.GetComponentInChildren <RoundedCube>().setTweetText(text);

                    clone.GetComponent <RoundedCube>().cube_grp.transform.Rotate(Vector3.up * Random.Range(0, 20));

                    clone.GetComponentInChildren <RoundedCube>().ambient = true;

                    floats_array.Add(clone);

                    counter++;
                }
            }
        }

        //turnOnFloaters();

        INIT = true;
    }
Beispiel #4
0
    public void buildCubes()
    {
        DestroyAllCubes();

        int counter = 0;

        float cube_root = TweetsList.Count;

        //MAXIMUM OF 10
        if (cube_root > 10)
        {
            cube_root = 10;
        }

        screeners_array = new List <GameObject>();

        for (float x = 0; x < cube_root; ++x)
        {
            GameObject clone = Instantiate(rounded_cube, new Vector3(-20.0f, Random.Range(-1.5f, 1.5f), 0), transform.rotation) as GameObject;
            clone.GetComponent <RoundedCube>().image_quad.SetActive(true);

            clone.transform.parent = transform;

            //ADD TWITTER DATA TO CUBE
            twitterData = TweetsList[counter];

            DynamicTexture dtex = clone.GetComponentInChildren <DynamicTexture>();

            Text tweet = clone.GetComponentInChildren <Text>();

            if (twitterData.tweetMedia != "")
            {
                dtex.url = twitterData.tweetMedia;
                dtex.Apply(true);
                clone.GetComponent <RoundedCube>().hasImage = true;
            }
            else
            {
                clone.GetComponent <RoundedCube>().image_quad.SetActive(false);
            }

            string text = twitterData.tweetText;

            clone.GetComponentInChildren <RoundedCube>().setTweetText(text);

            //THESE ARE ALL OUR FLOATERS
            //clone.GetComponent<RoundedCube>().floater = true;

            clone.GetComponent <RoundedCube>().index = 5 / 2 * Random.Range(-2.0f, 2.0f);

            clone.GetComponent <RoundedCube>().ypos = Random.Range(-1.5f, 1.5f);

            screeners_array.Add(clone);

            counter++;
        }

        turnOnFloater();

        INIT = true;
    }