Exemple #1
0
    public void CreateToy(int type = 0)
    {
        Debug.Log("current scene: " + SceneManager.GetActiveScene().name);
        if (SceneManager.GetActiveScene().name == "1-level")
        {
            int        rand       = (int)(Random.value * (ToyPrefabs.Count - 1));
            GameObject randPrefab = ToyPrefabs[rand];

            GameObject instance = Instantiate(randPrefab, SpawnLocation.position, SpawnLocation.rotation);
            TextMesh   display  = instance.GetComponentInChildren <TextMesh>();
            stringManager.AddToyString(display);
            SpawnIntervall      = SpawnIntervall - spawnIntervallSpeed;
            spawnIntervallSpeed = spawnIntervallSpeed + 0.001f;
        }
    }