Пример #1
0
    public void GenerateLevel()
    {
        for (int i = 0; i < 8; i++)
        {
            LevelBlock _newBlock = null;
            if (i < 3)
            {
                _newBlock = levelBlockPooler.GetLevelBlock(BlockDifficulty.None);
            }
            else
            {
                _newBlock = levelBlockPooler.GetLevelBlock(BlockDifficulty.Easy);
            }
            levelBlocks.Add(_newBlock);
            if (i == 0)
            {
                _newBlock.gameObject.SetActive(true);
                _newBlock.InitializeBlock(CollectableCallback, numBlocksGenerated, coinSpinTime);
                _newBlock.SetPosition(Vector3.zero);
                _newBlock.SetSpeed(currentBlockSpeed);
                numBlocksGenerated++;
            }
            else
            {
                _newBlock.gameObject.SetActive(true);
                _newBlock.InitializeBlock(CollectableCallback, numBlocksGenerated, coinSpinTime);
                _newBlock.SetPosition(levelBlocks[i - 1].GetPosition() + (Vector3.forward * levelBlockSize));
                _newBlock.SetSpeed(currentBlockSpeed);
                numBlocksGenerated++;
            }
        }

        rhinoDetection.SetSpeed(currentBlockSpeed);
    }
Пример #2
0
    private void GetNewBlock()
    {
        if (!tutorialCompleted)
        {
            tutorialCount++;

            if (tutorialCount == 2)
            {
                tutorialManager.DisplayArrowTutorial();
            }
            else if (tutorialCount == 6)
            {
                tutorialManager.DisplayChargeTutorial();
            }
            else if (tutorialCount == 7)
            {
                tutorialManager.DisplayStaminaTutorial();
            }
            else if (tutorialCount == 9)
            {
                tutorialManager.SetTutorialCompleted();
                tutorialCompleted = true;
            }
        }

        LevelBlock _newBlock = null;

        if (staminaSpawnCounter >= currentStaminaSpawn)
        {
            _newBlock           = levelBlockPooler.GetLevelBlock(BlockDifficulty.Stamina);
            staminaSpawnCounter = 0;
            currentStaminaSpawn = GenerateStaminaSpawnNumber();
        }
        else if (powerUpSpawnCounter >= currentPowerUpSpawn)
        {
            _newBlock           = levelBlockPooler.GetPowerUpBlock(avaliableUpgrades);
            powerUpSpawnCounter = 0;
            currentPowerUpSpawn = GeneratePowerUpSpawnNumber();
        }
        else
        {
            _newBlock = DetermineBlock(currentDifficulty);
        }

        _newBlock.gameObject.SetActive(true);
        _newBlock.InitializeBlock(CollectableCallback, numBlocksGenerated, coinSpinTime);
        _newBlock.SetPosition(levelBlocks[levelBlocks.Count - 1].GetPosition() + (Vector3.forward * levelBlockSize));
        _newBlock.SetSpeed(currentBlockSpeed);
        levelBlocks.Add(_newBlock);
        levelBlocks.RemoveAt(0);
        numBlocksGenerated++;
        blocksPassed++;
        totalBlocksPassed++;
        staminaSpawnCounter++;
        powerUpSpawnCounter++;

        if (blocksPassed >= difficultyThreshold)
        {
            blocksPassed = 0;
            IncreaseDifficulty();
        }

        if (OnBlockPassed != null)
        {
            OnBlockPassed();
        }

        IncreaseSpeed();
    }