예제 #1
0
    private void GenerateRandom()
    {
        float time         = Storage.AmountPlayed;
        int   amountOfWall = (int)AllSettings.AmountOfRingsOnSide.Evaluate(time);
        var   ballHigh     = AllSettings.StartPosition.Evaluate(time);
        var   ballSize     = 0.4f; //AllSettings.SizeOfSideBalls.Evaluate(time);
        var   speed        = 10f;  //AllSettings.BallObstacleSpeed.Evaluate(time);

        if (Settings.GameType == 1)
        {
            amountOfWall = 200;
            ballHigh     = 600;
            ballSize     = 1.2f;
            speed        = 10f;
        }

        GenerateLevelArgs(amountOfWall, ballHigh, ballSize, speed);

        var level    = LevelSettings.GetLevel(Storage.AmountPlayed);
        var startPos = StartBall.transform.position;
        var endPos   = StartBall.transform.position + Vector3.up * (ballHigh);


        if (Settings.GameType == 0)
        {
            if (level.AmountChunk1)
            {
                GenerateChucks(Chunck1, startPos, endPos / 3,
                               ballSize + Random.Range(0f, 0.6f), speed);
            }

            if (level.AmountChunk2)
            {
                GenerateChucks(Chunck2, startPos + endPos / 3, endPos * 2 / 3,
                               ballSize + Random.Range(0f, 0.6f), speed);
            }

            if (level.AmountChunk3)
            {
                GenerateChucks(Chunck3, startPos + endPos * 2 / 3, endPos,
                               ballSize + Random.Range(0f, 0.6f), speed);
            }
        }

        RemoveDublicates();

        GeneratePowerUps(StartLeftWall.transform.position + Vector3.left * 2f,
                         StartBall.transform.position + Vector3.up * (ballHigh / 2), level.PowerUpAmount);

        OnSpeedUp_SaveZone();
        DeleteTooCloseObstacles(ballSize + 0.5f);

        RemoveUnderFinish();
        AllingAllWalls();
        RemoveAtEndObstacles(endPos.y);
    }
예제 #2
0
 public void StartNewLevel()
 {
     _currentLevel++;
     TimeLord.Instance.SetLevelTime(_timeFromLastLevel + _levelSettings.GetLevel(_currentLevel).TimeToAdd);
 }