예제 #1
0
 public virtual void SetAIDifficulty(AIDifficultySettings difficulty)
 {
     if (difficulty != null)
     {
         UFE.SetAIDifficulty(difficulty.difficultyLevel);
     }
 }
    protected virtual int GetDifficultyIndex(AIDifficultySettings difficulty)
    {
        AIDifficultySettings[] difficultySettings = UFE.config.aiOptions.difficultySettings;
        int count = difficultySettings.Length;

        for (int i = 0; i < count; ++i)
        {
            if (difficulty == difficultySettings[i])
            {
                return(i);
            }
        }

        return(-1);
    }
    public override void SetAIDifficulty(AIDifficultySettings difficulty)
    {
        if (this.visible)
        {
            base.SetAIDifficulty(difficulty);

            if (this.difficultySlider != null)
            {
                this.difficultySlider.value = this.GetDifficultyIndex(difficulty);
            }

            if (this.difficultyName != null)
            {
                this.difficultyName.text = difficulty.difficultyLevel.ToString();
            }
        }
    }
    public override void OnShow()
    {
        base.OnShow();
        this.visible = true;

        if (this.music != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlayMusic(this.music); }, this.delayBeforePlayingMusic);
        }

        if (this.stopPreviousSoundEffectsOnLoad)
        {
            UFE.StopSounds();
        }

        if (this.onLoadSound != null)
        {
            UFE.DelayLocalAction(delegate(){ UFE.PlaySound(this.onLoadSound); }, this.delayBeforePlayingMusic);
        }

        if (this.musicToggle != null)
        {
            this.musicToggle.isOn = UFE.config.music;
        }

        if (this.musicSlider != null)
        {
            this.musicSlider.value = UFE.config.musicVolume;
        }

        if (this.soundToggle != null)
        {
            this.soundToggle.isOn = UFE.config.soundfx;
        }

        if (this.soundSlider != null)
        {
            this.soundSlider.value = UFE.config.soundfxVolume;
        }

        int difficultySettingsLength    = UFE.config.aiOptions.difficultySettings.Length;
        AIDifficultySettings difficulty = UFE.GetAIDifficulty();

        if (this.difficultySlider != null)
        {
            this.difficultySlider.minValue     = 0;
            this.difficultySlider.maxValue     = difficultySettingsLength - 1;
            this.difficultySlider.wholeNumbers = true;
            this.difficultySlider.value        = this.GetDifficultyIndex(difficulty);
        }

        if (this.difficultyName != null)
        {
            this.difficultyName.text = difficulty.difficultyLevel.ToString();
        }

        if (this.aiEngineName != null)
        {
            AIEngine aiEngine = UFE.GetAIEngine();

            if (aiEngine == AIEngine.RandomAI)
            {
                this.aiEngineName.text = "Random";
            }
            else
            {
                this.aiEngineName.text = "Fuzzy";
            }
        }

        if (this.debugModeToggle != null)
        {
            this.debugModeToggle.isOn = UFE.config.debugOptions.debugMode;
        }

        if (this.diagnosticModeToggle != null)
        {
            GameObject nameObj = GameObject.Find("Name");
            if (nameObj != null)
            {
                NameHolder name = nameObj.GetComponent <NameHolder>();
                if (name != null)
                {
                    this.diagnosticModeToggle.isOn = name.diagnosticMode;
                }
                else
                {
                    Debug.Log("Could not find nameholder script");
                }
            }
            else
            {
                Debug.Log("Could not find name object");
            }
        }
        if (this.changeControlsButton != null)
        {
            this.changeControlsButton.gameObject.SetActive(
                UFE.isCInputInstalled && UFE.config.inputOptions.inputManagerType == InputManagerType.cInput
                );
        }

        this.HighlightOption(this.FindFirstSelectable());
    }
예제 #5
0
 public virtual void SetAIDifficulty(AIDifficultySettings difficulty)
 {
     if (difficulty != null){
         UFE.SetAIDifficulty(difficulty.difficultyLevel);
     }
 }
예제 #6
0
    public static void SetAIDifficulty(AIDifficultySettings difficulty)
    {
        UFE.config.aiOptions.selectedDifficulty = difficulty;
        UFE.config.aiOptions.selectedDifficultyLevel = difficulty.difficultyLevel;

        for (int i = 0; i < UFE.config.aiOptions.difficultySettings.Length; ++i){
            if (difficulty == UFE.config.aiOptions.difficultySettings[i]){
                PlayerPrefs.SetInt(UFE.DifficultyLevelKey, i);
                PlayerPrefs.Save();
                break;
            }
        }
    }
    protected virtual int GetDifficultyIndex(AIDifficultySettings difficulty)
    {
        AIDifficultySettings[] difficultySettings = UFE.config.aiOptions.difficultySettings;
        int count = difficultySettings.Length;

        for (int i = 0; i < count; ++i){
            if (difficulty == difficultySettings[i]){
                return i;
            }
        }

        return -1;
    }
    public override void SetAIDifficulty(AIDifficultySettings difficulty)
    {
        if (this.visible){
            base.SetAIDifficulty (difficulty);

            if (this.difficultySlider != null){
                this.difficultySlider.value = this.GetDifficultyIndex(difficulty);
            }

            if (this.difficultyName != null){
                this.difficultyName.text = difficulty.difficultyLevel.ToString();
            }
        }
    }