Example #1
0
    void SpawnNewLevel()
    {
        Instantiate(platformPrefabs[Random.Range(0, platformPrefabs.Length - 1)], new Vector3(0, platformHeight * level + 5, 0), Quaternion.identity);
        GameObject go    = (GameObject)Instantiate(knifes, new Vector3(0, platformHeight * level + 5, 0), Quaternion.identity);
        WallScript wall1 = go.transform.GetChild(0).gameObject.GetComponent <WallScript>();
        WallScript wall2 = go.transform.GetChild(1).gameObject.GetComponent <WallScript>();

        wall1.ChangeValues((gameSpeed * 0.1f), (gameSpeed * 0.5f)); //Sets up the values for the wall script to move in accordance with the game
        wall2.ChangeValues((gameSpeed * 0.1f), (gameSpeed * 0.5f)); //Sets up the values for the wall script to move in accordance with the game
    }