Exemplo n.º 1
0
    void Start()
    {
        sushis = transform.FindChild("Sushis");
        pManager = GameObject.Find("SushiManager").GetComponent<FlockManager>();
           // transform.Rotate(Vector3.up * Random.Range(0f, 360f));
        //+1 because random.range second argument is exlusive
        quantity = Random.Range(minQuantity, maxQuantity + 1);
        for (int i = 0; i < quantity; i++)
        {
            GameObject sushi = Instantiate(pManager.GetRandomSushi());
            sushi.transform.parent = sushis;

            sushi.GetComponent<Rigidbody>().isKinematic = true;
            sushi.GetComponent<Rigidbody>().detectCollisions = false;
            sushi.transform.localPosition = new Vector3(-1f+1*i%2 , 1 , -1.5f+2f*(i/2));
            sushi.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

        }
    }