Пример #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            numSpace++;
            time = 0;
        }

        if (Input.GetKeyDown(KeyCode.K))
        {
            numK++;
        }

        if (numK > 10)
        {
            int colorID = Random.Range(0, flowerColors.Length - 1);
            SpawnSystem.SpawnFlower(flower, flowerColors[colorID], spawnPoints, gameObject.transform);
            numK = 0;
        }

        if (time > 1)
        {
            for (int i = 0; i < numSpace; i++)
            {
                SpawnSystem.SpawnFlower(flower, flowerColors[0], spawnPoints, gameObject.transform);
            }

            time     = 0;
            numSpace = 0;
        }

        time += Time.deltaTime;
    }