コード例 #1
0
 void Update()
 {
     if (currentStage == 1)
     {
         if (lgm.GetAmountOfBlocksBuilt() > blocksBeforeSecondStage && hasNotMovedToTwo)
         {
             currentStage     = 2;
             hasNotMovedToTwo = false;
         }
     }
     else if (currentStage == 2)
     {
         if (lgm.GetAmountOfBlocksBuilt() > blocksBeforeThirdStage && hasNotMovedToThree)
         {
             currentStage       = 3;
             hasNotMovedToThree = false;
         }
     }
     else if (currentStage == 3)
     {
         if (lgm.GetAmountOfBlocksBuilt() > blocksBeforeFourthStage && hasNotMovedToFour)
         {
             currentStage      = 4;
             hasNotMovedToFour = false;
         }
     }
     else if (currentStage == 4)
     {
         if (lgm.GetAmountOfBlocksBuilt() > blocksBeforeFifthStage && hasNotMovedToFive)
         {
             currentStage      = 5;
             hasNotMovedToFive = false;
         }
     }
 }
コード例 #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);
            }
        }
    }