Exemplo n.º 1
0
    void Update()
    {
        int     sw      = Screen.width;
        int     sh      = Screen.height;
        float   between = Random.Range(1, 5);
        Vector3 pos     = Camera.main.ViewportToWorldPoint(new Vector3(0 + Random.Range(-7, 7), 0 + Random.Range(-7, 7), bull.position.z));

        pos.y += between / 2;

        respawnIndex++;

        if (respawnIndex >= respawnIntervalTime)
        {
            respawnIndex = 0;
            GameObject prefabCat = Instantiate(prefab, pos, transform.rotation);
            cats       cat       = prefabCat.GetComponent <cats> ();
            cat.SetBull(bull.gameObject);
            prefabCat.transform.parent = this.transform;
        }

        //GameObject prefab = Instantiate<GameObject> (catty[0]);
        //prefab.transform.position = Camera.main.ScreenToWorldPoint(pos)/*+Vector3.forward* cat.position.z/*1f*Cat.position.z*//*Vector3.right*/;
        //cats[0].Add(prefab);
        //}
    }
Exemplo n.º 2
0
    void Update()
    {
        int     sw      = Screen.width;
        int     sh      = Screen.height;
        float   between = Random.Range(1, 5);
        Vector3 pos     = Camera.main.ViewportToWorldPoint(new Vector3(0 + Random.Range(4, 7), 0 + Random.Range(-7, 7), bull.position.z));

        pos.y += between / 2;

        respawnIndex++;

        if (respawnIndex >= respawnIntervalTime)
        {
            respawnIndex = 0;
            GameObject prefabCat = Instantiate(prefab, pos, transform.rotation);
            cats       cat       = prefabCat.GetComponent <cats> ();
            cat.SetBull(bull.gameObject);
            prefabCat.transform.parent = this.transform;
            //GameObject prefabStone = Instantiate (prefabS, posS, transform.rotation);
        }
    }