Exemplo n.º 1
0
 public LevelGenerator(LevelGenerator source)
 {
     obstaclePool = source.obstaclePool;
     coinPool     = source.coinPool;
     gasPool      = source.gasPool;
     difficulty   = source.difficulty;
     renderConfig = source.renderConfig;
     gameState    = source.gameState;
 }
Exemplo n.º 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;
        }
    }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
    public static int GetCost(string upgrade, int level, LevelDifficultyScriptableObject difficulty)
    {
        int cost = 0;

        switch (upgrade)
        {
        case "Racer":
            cost = 5000;
            break;

        case "SUV":
            cost = 5000;
            break;

        case "Acceleration":
            cost = (int)(10 * CurveUtil.MultiplierSample(
                             difficulty.accelerationUpgradeMuliplierCurve,
                             (float)level / numberOfLevels,
                             maxAccelerationMultiplier));
            break;

        case "Body":
            cost = (int)(11 * CurveUtil.MultiplierSample(
                             difficulty.bodyUpgradeMuliplierCurve,
                             (float)level / numberOfLevels,
                             maxBodyMultiplier));
            break;

        case "Efficiency":
            cost = (int)(12 * CurveUtil.MultiplierSample(
                             difficulty.efficiencyUpgradeMuliplierCurve,
                             (float)level / numberOfLevels,
                             maxEfficiencyMultiplier));
            break;

        default:
            break;
        }

        return(cost);
    }