예제 #1
0
    void SpeedUpBlocks()
    {
        List <GameObject> blocks = lgm.GetBlocks();

        foreach (GameObject block in blocks)
        {
            MoveTowardCamera blockBehave = block.GetComponent <MoveTowardCamera>();
            blockBehave.SetMovementSpeed(currentMovementSpeed);
        }

        blockSpeedLevel++;
    }
예제 #2
0
    void Update()
    {
        if (!isTutorial)
        {
            if (lum.GetCurrentSpeedLevel() == 1)
            {
                if (lgm.GetAmountOfBlocksBuilt() > blocksBeforeSecondSpeed && hasNotMovedToTwo)
                {
                    lgm.SpawnSpeedUpBlock();
                    hasNotMovedToTwo = false;
                }
            }

            if (lum.GetCurrentSpeedLevel() == 2)
            {
                currentMovementSpeed = secondMovementSpeed;
                if (blockSpeedLevel != 2)
                {
                    SpeedUpBlocks();
                }

                if (lgm.GetAmountOfBlocksBuilt() > blocksBeforeThirdSpeed && hasNotMovedToThree)
                {
                    lgm.SpawnSpeedUpBlock();
                    hasNotMovedToThree = false;
                }
            }

            if (lum.GetCurrentSpeedLevel() == 3)
            {
                currentMovementSpeed = thirdMovementSpeed;
                if (blockSpeedLevel != 3)
                {
                    SpeedUpBlocks();
                }

                if (lgm.GetAmountOfBlocksBuilt() > blocksBeforeFourthSpeed && hasNotMovedToFour)
                {
                    lgm.SpawnSpeedUpBlock();
                    hasNotMovedToFour = false;
                }
            }
            if (lum.GetCurrentSpeedLevel() == 4)
            {
                currentMovementSpeed = fourthMovementSpeed;
                if (blockSpeedLevel != 4)
                {
                    SpeedUpBlocks();
                }
            }
            if (lum.GetCurrentSpeedLevel() == 5)
            {
                currentMovementSpeed = fifthMovementSpeed;
                if (blockSpeedLevel != 5)
                {
                    SpeedUpBlocks();
                }
            }
        }

        if (player == null)
        {
            player = GameObject.Find("Player Character").GetComponent <PlayerCharacter>();
            currentMovementSpeed += player.GetBaseMovementSpeed();
            firstMovementSpeed   += player.GetBaseMovementSpeed();
            secondMovementSpeed  += player.GetBaseMovementSpeed();
            thirdMovementSpeed   += player.GetBaseMovementSpeed();
            fourthMovementSpeed  += player.GetBaseMovementSpeed();
            fifthMovementSpeed   += player.GetBaseMovementSpeed();

            List <GameObject> blocks = lgm.GetBlocks();
            foreach (GameObject block in blocks)
            {
                MoveTowardCamera blockBehave = block.GetComponent <MoveTowardCamera>();
                blockBehave.SetMovementSpeed(currentMovementSpeed);
            }
        }
    }