Exemplo n.º 1
0
    private void CreateNewBalloon(float rotationDegrees)
    {
        Balloon newBalloon = (Balloon)Instantiate(balloonPrefab, transform.position, Quaternion.identity);

        newBalloon.name = "BalloonPrefab";
        newBalloon.transform.localScale *= sizeDecrement;
        newBalloon.balloonsInCluster     = this.balloonsInCluster / 2;
        LinearFlight flight = newBalloon.GetComponent <LinearFlight>();

        flight.IncrementSpeed();
        flight.RotateFlightDirection(rotationDegrees);
    }
Exemplo n.º 2
0
    void CreateBalloonClusters()
    {
        for (int i = 0; i < numBalloonClusters; i++)
        {
            Vector3 randomPosition = new Vector3(UnityEngine.Random.Range(0.2f, 0.8f), UnityEngine.Random.Range(0.2f, 0.8f), 10.0f);
            Vector3 worldPos       = Camera.main.ViewportToWorldPoint(randomPosition);
            Balloon balloonCluster = (Balloon)Instantiate(balloonPrefab, worldPos, Quaternion.identity);
            balloonCluster.name = "BalloonCluster";
            LinearFlight flight = balloonCluster.GetComponent <LinearFlight>();
            flight.RotateFlightDirection(UnityEngine.Random.Range(0f, 360f));

            balloonClusters.Add(balloonCluster);
        }
    }