Exemplo n.º 1
0
    void CreateCloud() //generates clouds offscreen.
    {
        float startX = 25, startY = Random.Range(0, 20);
        float xVelocity = Random.Range(.1f, .3f);

        startX = -12 + Random.Range(4, 16);

        GameObject cloud = Instantiate(clouds[0]);
        CloudData  data  = cloud.GetComponent <CloudData>();

        data.SetPos(new Vector2(startX, startY));
        data.SetVelocity(new Vector2(xVelocity, .001f));

        activeClouds.Add(data);
    }