Example #1
0
    /*
     *  This is where actual initialization of this script happenes.
     *  It also links to heightScript since both scripts works very closely together.
     *  Therefore, no seperate initialization methods such as Awake and Start on heightScript is needed.
     *
     *  Note :
     *      Any methods that require networking does not work when doing initialization.
     */
    private void syncDifficulty(Difficulty oldDifficulty, Difficulty newDifficulty)
    {
        heightCanvasPivotX = heightCanvasRectTransform.pivot.x;
        switch (difficulty)
        {
        case (Difficulty.Sandbox): {
            newObjectiveScoreAddition = 10;
            newSecond       = 60;
            windSustainTime = 1;
            minimumDifferenceForEachWinds = 5;
            windGenerationHeight          = 50;
            cannonShootingDelay           = 5f;
            break;
        }

        case (Difficulty.Easy): {
            newObjectiveScoreAddition = 10;
            newSecond       = 15;
            windSustainTime = 2;
            minimumDifferenceForEachWinds = 5;
            windGenerationHeight          = 50;
            cannonShootingDelay           = 3f;
            break;
        }

        case (Difficulty.Moderate): {
            newObjectiveScoreAddition = 15;
            newSecond       = 15;
            windSustainTime = 3;
            minimumDifferenceForEachWinds = 3;
            windGenerationHeight          = 40;
            cannonShootingDelay           = 2f;
            break;
        }

        case (Difficulty.Difficult): {
            newObjectiveScoreAddition = 20;
            newSecond       = 13;
            windSustainTime = 3;
            minimumDifferenceForEachWinds = 3;
            windGenerationHeight          = 30;
            cannonShootingDelay           = 1f;
            break;
        }

        case (Difficulty.Extreme): {
            newObjectiveScoreAddition = 20;
            newSecond       = 10;
            windSustainTime = 3;
            minimumDifferenceForEachWinds = 2;
            windGenerationHeight          = 25;
            cannonShootingDelay           = 0.5f;
            break;
        }
        }
        _heightScript.syncDifficulty(difficulty);
        generateObjective(true);
        if (isServer == true)
        {
            StartCoroutine(countDown());
        }
        return;
    }