Beispiel #1
0
    internal virtual void Update()
    {
        timer += Time.deltaTime;

        if (isLevel)
        {
            if (timer > levelLength)
            {
                timer            -= levelLength;
                spawner.isWorking = false;
                isLevel           = false;
                SetLevelColorOverlay(Color.gray);
            }
        }
        else
        {
            if (timer > waitPeriodLength)
            {
                timer            -= waitPeriodLength;
                isLevel           = true;
                spawner.isWorking = true;
            }
            else
            {
                var       values = LevelType.GetValues(typeof(LevelType));
                LevelType type   = (LevelType)values.GetValue(Random.Range(0, values.Length));
                spawner.GenerateWeights(type);
                SetLevelColorOverlay(Levels.Colors[type]);
            }
        }
    }