예제 #1
0
 // Update is called once per physics frame
 void FixedUpdate()
 {
     for (int i = 0; i < currentStage.obstacles.Length; i++)
     {
         while (distances[i] <= 0)
         {
             ObstacleManager.Get(currentStage.obstacles[i].ID).Set(currentStage.obstacles[i].ID);
             // GameObject newObstacle = Instantiate(obstacles[currentStage.obstacles[i].ID], new Vector3(GameRules.wallsPositions.Random, 0, GameRules.obstacleSpawnDistance), Quaternion.identity);
             distances[i] += currentStage.obstacles[i].distance / GameRules.obstacleSpawnMultiplier;
         }
         distances[i] -= GameRules.playerSpeed * Time.fixedDeltaTime;
     }
     if (Input.GetKeyDown(KeyCode.Space))
     {
         ChooseRandomStage();
     }
 }