예제 #1
0
 public LevelGenerator(LevelGenerator source)
 {
     obstaclePool = source.obstaclePool;
     coinPool     = source.coinPool;
     gasPool      = source.gasPool;
     difficulty   = source.difficulty;
     renderConfig = source.renderConfig;
     gameState    = source.gameState;
 }
예제 #2
0
    public static void SetNextGasLocation(GameStateScriptableObject gameState, LevelDifficultyScriptableObject difficulty)
    {
        float timeLeft = difficulty.timeBetweenGas;

        while (timeLeft > 0f)
        {
            float timeSpentInLevel = difficulty.cumLevelDists[gameState.gasLevel] - gameState.nextGasLocation;
            gameState.nextGasLocation += Mathf.Min(timeLeft, timeSpentInLevel) * difficulty.GetMaxSpeed(gameState.gasLevel);
            if (timeSpentInLevel < timeLeft)
            {
                gameState.gasLevel += 1;
            }

            timeLeft -= timeSpentInLevel;
        }
    }
예제 #3
0
 public LevelGenerator(
     GameObject[] obstacles,
     Transform obstaclesParent,
     GameObject coin,
     GameObject gas,
     Transform itemsParent,
     LevelDifficultyScriptableObject difficulty,
     RenderConfigScriptableObject renderConfig,
     GameStateScriptableObject gameState)
 {
     obstaclePool      = new MixedObjectPool(obstacles, obstaclesParent, 20);
     coinPool          = new ObjectPool(coin, itemsParent, 20);
     gasPool           = new ObjectPool(gas, itemsParent, 5);
     this.difficulty   = difficulty;
     this.renderConfig = renderConfig;
     this.gameState    = gameState;
     curPosn_LC        = 0.2f;
 }