Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (catSpawner.spawnCat)
        {
            SpawnCat();
        }
        else if (currentSpawnNumber < spawnNumberMax)
        {
            SpawnAnimal();
            currentSpawnNumber++;
        }
        else if (currentSpawnNumber == spawnNumberMax)
        {
            isSpawnEnd = true;
        }

        if (isSpawnEnd && !isCatDetected)
        {
            catSpawner.DetectCat();
            isCatDetected = true;

            if (!catSpawner.isCatSpawned)
            {
                Debug.Log("Cat not spawned, replace animal with cat!");
                ReplaceAnimalWithCat();
            }


            if (catSpawner.isCatKilled)
            {
                Debug.Log("replace animal with cat!");
                ReplaceAnimalWithCat();
            }
        }
    }