예제 #1
0
    /// <summary>
    /// Reads in selected options from the options panel.
    /// </summary>
    void ApplyGameOptions()
    {
        //First just figure out if it's a boss fight or not.
        Dictionary <string, string> selectedOptions = _optionsPanel.GetSelectedOptions();

        foreach (string sKey in selectedOptions.Keys)
        {
            Debug.Log("Option: " + sKey + " - " + selectedOptions[sKey]);
        }

        _bossFight = false;
        if (selectedOptions.ContainsKey(OPTION_MENU_MODE))
        {
            if (selectedOptions[OPTION_MENU_MODE] == OPTION_MENU_MODE_VALUE_BOSS)
            {
                _bossFight = true;
            }
            else
            {
                _bossFight = false;
            }
        }

        //Determine victories needed
        _victoriesNeededToWin = 1;
        _party1VictoryCount   = 0;
        _party2VictoryCount   = 0;
        if (selectedOptions[OPTION_MENU_ROUNDS] == "1")
        {
            _victoriesNeededToWin = 1;
            _roundCount           = 1;
        }
        else if (selectedOptions[OPTION_MENU_ROUNDS] == "3")
        {
            _victoriesNeededToWin = 2;
            _roundCount           = 3;
        }
        else if (selectedOptions[OPTION_MENU_ROUNDS] == "5")
        {
            _victoriesNeededToWin = 3;
            _roundCount           = 5;
        }
        else if (selectedOptions[OPTION_MENU_ROUNDS] == "7")
        {
            _victoriesNeededToWin = 4;
            _roundCount           = 7;
        }

        //Determine crit chance, if any
        float dCritChance = 0;

        if (selectedOptions.ContainsKey(OPTION_MENU_CRIT_CHANCE))
        {
            string sCritChance = selectedOptions[OPTION_MENU_CRIT_CHANCE];
            if (!String.IsNullOrEmpty(sCritChance))
            {
                sCritChance = sCritChance.Remove(sCritChance.Length - 1, 1);
                dCritChance = float.Parse(sCritChance) * .01f;
            }
        }

        if (_bossFight)
        {
            _buffParty1CritChance = dCritChance;
            _buffParty2CritChance = 0;
        }
        else
        {
            _buffParty1CritChance = dCritChance;
            _buffParty2CritChance = dCritChance;
        }

        //Determine Player Health
        float dPlayerHealth = _pvpStartHealth;

        if (selectedOptions.ContainsKey(OPTION_MENU_PLAYER_HEALTH))
        {
            string sPlayerHealth = selectedOptions[OPTION_MENU_PLAYER_HEALTH];
            if (!String.IsNullOrEmpty(sPlayerHealth))
            {
                dPlayerHealth = float.Parse(sPlayerHealth);
            }
        }

        //Apply health buffs/debuffs to starting health meters

        //If it's a PVP fight then player 1 uses the boss's stats. Otherwise it copies player 1.
        //We do this so the PVP fight lasts a good long while.

        //Don't apply debuffs/buffs during PVP.
        _pvpStartHealth = dPlayerHealth;

        //It's PVE... apply the debuffs to boss health.
        _bossStartHealth = BossStartHealth * (1 - _buffDecreaseBossHealthPercent);
        _pveStartHealth  = PVEStartHealth * (1 + _buffIncreasePlayerHealthPercent);

        //Determine Music Volume
        if (selectedOptions.ContainsKey(OPTION_MENU_MUSIC_VOLUME))
        {
            string sMusicVolume = selectedOptions[OPTION_MENU_MUSIC_VOLUME];
            if (!String.IsNullOrEmpty(sMusicVolume))
            {
                _musicVolume = float.Parse(sMusicVolume) * 0.1f;
            }
        }

        //Re-initialize the buttons for the current fight.
        _buttonMaster.SetupButtons(_bossFight);

        StartGetReadyScreen();
        //StartLoadingScreen();
    }