Beispiel #1
0
    private void SpawnDrop()
    {
        FallingObjectData data = possibleDrops[Random.Range(0, possibleDrops.Count)];


        Drop  newDrop   = Instantiate(dropPrefab);
        float xPosition = Random.Range(spawnMostLeft, spawnMostRight);

        newDrop.transform.position = new Vector3(xPosition, spawnHeight, 0f);
        newDrop.Initialize(data);
    }
Beispiel #2
0
    void CreateDrops()
    {
        int        leftLevel  = rnd.Next(maxLevel + 1);
        int        rightLevel = rnd.Next(maxLevel + 1);
        GameObject leftDrop   = Instantiate(dropPrefabs[leftLevel], new Vector3(0, 9.5f, 0), Quaternion.identity);
        GameObject rightDrop  = Instantiate(dropPrefabs[rightLevel], new Vector3(1, 9.5f, 0), Quaternion.identity);

        activeDrop1 = leftDrop.GetComponent <Drop> ();
        activeDrop1.Initialize(leftLevel, 0, 9.5f);

        activeDrop2 = rightDrop.GetComponent <Drop> ();
        activeDrop2.Initialize(rightLevel, 1, 9.5f);
    }