예제 #1
0
    //Call this once when the game opens or the current objective is cleared.
    void PickRandomObjective()
    {
        //Reset progress/goal variables
        progressAmount = 0;
        goalAmount     = 0;
        subObjectiveID = -1;

        //Pick a random objective
        objectiveID = Random.Range(0, (int)Objective.FIND_POWERUP + 1);

        //Make sure theme is unlocked when using a beat level theme objective
        if (objectiveID == (int)Objective.BEAT_THEMED_LEVELS)
        {
            //Make sure theme exists
            List <Skins.Themes> themesAvailable = Skins.GetThemePool();

            //Now select a random element from that list of unlocked themes
            subObjectiveID = (int)themesAvailable[Random.Range(0, themesAvailable.Count)];
        }


        if (objectiveID == (int)Objective.FIND_POWERUP)
        {
            subObjectiveID = Random.Range(0, 3);
        }



        switch (objectiveID)
        {
        case 0:
        case 1:
            goalAmount = 10;
            break;

        case 2:
        case 3:
            goalAmount = 5;
            break;

        case 4:
            goalAmount = 2;
            break;

        case 5:
            goalAmount = 3;
            break;
        }


        objectiveSet = true;
    }