Beispiel #1
0
 void Awake()
 {
     timeToLive            = TimeToLive.Generate();
     Rotator.RotationSpeed = Speed.Generate();
 }
Beispiel #2
0
    private void GenerateClouds()
    {
        while (CloudsParent.childCount > 0)
        {
            DestroyImmediate(CloudsParent.GetChild(0).gameObject);
        }

        for (int i = 0; i < NumberOfClouds; i++)
        {
            GameObject cloud = Instantiate(CloudPrefab, CloudsParent);
            cloud.transform.localPosition             = Vector3.forward * (Random.Range(0.0f, 1.0f) > ChanceToBeOnFront? 2.0f : -2.0f) * Random.Range(0.9f, 1.1f);
            cloud.transform.GetChild(0).localPosition = Vector3.up * (CurrentRadius + CloudsHeight.Generate());

            cloud.GetComponent <Rotator>().RotationSpeed = Random.Range(-2.0f, 2.0f);

            cloud.GetComponentInChildren <RandomAroundPlanet>().Position();
            cloud.GetComponentInChildren <RandomTexture>().SetRandom();
        }
    }