}     // End of OnStartServer().

    private void Update()
    {
        trailController.SetCount(eegConcent);
        trailController.SetWidth(eegMellow);
        trailController.SetSpeed(hrv);
        trailController.SetColor(playerColor);

        if (graphicRenderer)
        {
            graphicRenderer.material.SetColor("_TintColor", Color.Lerp(graphicRenderer.material.GetColor("_TintColor"), Color.Lerp(playerColor, Color.black, 0.5f), Time.deltaTime * 0.1f));
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            pivotIndicator.SetActive(false);
        }

        if (isLocalPlayer)
        {
            transform.position = CameraController.Inst.transform.position;
            transform.rotation = CameraController.Inst.transform.rotation;

            // Set origin to headset position with SPACEBAR
            if (Input.GetKeyDown(KeyCode.Space))
            {
                CameraController.Inst.transform.parent.rotation = Quaternion.Inverse(CameraController.Inst.transform.localRotation);
                Vector3 tempEulers = CameraController.Inst.transform.parent.eulerAngles;
                tempEulers.x = 0f;
                tempEulers.z = 0f;
                CameraController.Inst.transform.parent.eulerAngles = tempEulers;
                CameraController.Inst.transform.parent.position   -= CameraController.Inst.transform.position;

                PlayerPrefs.SetFloat("anchor_posX", CameraController.Inst.transform.parent.position.x);
                PlayerPrefs.SetFloat("anchor_posY", CameraController.Inst.transform.parent.position.y);
                PlayerPrefs.SetFloat("anchor_posZ", CameraController.Inst.transform.parent.position.z);

                PlayerPrefs.SetFloat("anchor_rotX", CameraController.Inst.transform.parent.rotation.x);
                PlayerPrefs.SetFloat("anchor_rotY", CameraController.Inst.transform.parent.rotation.y);
                PlayerPrefs.SetFloat("anchor_rotZ", CameraController.Inst.transform.parent.rotation.z);
                PlayerPrefs.SetFloat("anchor_rotW", CameraController.Inst.transform.parent.rotation.w);
            }

            updateCooldown = Mathf.MoveTowards(updateCooldown, 0f, Time.deltaTime);
            if (updateCooldown == 0f)
            {
                updateCooldown = 0.5f;

                if (MuseManager.Inst.MuseDetected)
                {
                    eegConcent = MuseManager.Inst.LastConcentrationMeasure;
                    GameObject.Find("slider_eeg_concent").GetComponentInChildren <Slider>().value = eegConcent;
                    if (eegConcent != eegConcent_last)
                    {
                        eegConcent_last = eegConcent;
                        Cmd_SetEEGConcent(eegConcent);
                    }

                    eegMellow = MuseManager.Inst.LastMellowMeasure;
                    GameObject.Find("slider_eeg_mellow").GetComponentInChildren <Slider>().value = eegMellow;
                    if (eegMellow != eegMellow_last)
                    {
                        eegMellow_last = eegMellow;
                        Cmd_SetEEGMellow(eegMellow);
                    }
                }

                if (hrvListener.Active)
                {
                    hrv = hrvListener.LastNormalizedSample;
                    if (hrv != hrv_last)
                    {
                        GameObject.Find("slider_hrv").GetComponentInChildren <Slider>().value = hrv;
                        hrv_last = hrv;
                        Cmd_SetHRV(hrv);
                    }
                }
            }
        }
    } // End of Update().
예제 #2
0
 public void ChangeMusicVolume()
 {
     music.volume = musicSlider.value;
     PlayerPrefs.SetFloat("MusicVolume", musicSlider.value);
 }
예제 #3
0
 public void Save()
 {
     PlayerPrefs.SetFloat("Volume", music.volume);
     PlayerPrefs.SetFloat("Brightness", dirLight.intensity);
 }
예제 #4
0
 public void SetVolume(float volume)
 {
     PlayerPrefs.SetFloat("volume", volume);
     FindObjectOfType <AudioSource> ().volume = PlayerPrefs.GetFloat("volume", 0.5f);
 }
예제 #5
0
 public void SaveVolume()
 {
     PlayerPrefs.SetFloat("BackgorundPref", backgound.value);
     PlayerPrefs.SetFloat("SfxPref", sfx.value);
     PlayerPrefs.SetFloat("MainPref", main.value);
 }
예제 #6
0
 public void SaveSoundSettings()
 {
     PlayerPrefs.SetFloat(BackgroundPref, backgroundFloat);
 }
예제 #7
0
 public void UpdateSensitivity()
 {
     Sensitivity = sensitivitySlider.value;
     PlayerPrefs.SetFloat("Sensitivity", Sensitivity);
     UpdateGUI();
 }
예제 #8
0
 public void setVolume(float volume)
 {
     //audioMixer.SetFloat ("volume",volume);
     AudioListener.volume = volume;
     PlayerPrefs.SetFloat("volumeLevel", AudioListener.volume);
 }
예제 #9
0
    void Start()
    {
        EstaNoMenuPrincipal = true;
        //Opcoes (false);
        ChecarResolucoes();
        AjustarQualidades();
        //
        if (PlayerPrefs.HasKey("RESOLUCAO"))
        {
            int numResoluc = PlayerPrefs.GetInt("RESOLUCAO");
            if (resolucoesSuportadas.Length <= numResoluc)
            {
                PlayerPrefs.DeleteKey("RESOLUCAO");
            }
        }
        //
        nomeDaCena     = SceneManager.GetActiveScene().name;
        Cursor.visible = true;
        Time.timeScale = 1;
        //
        BarraVolume.minValue = 0;
        BarraVolume.maxValue = 1;

        //=============== SAVES===========//
        if (PlayerPrefs.HasKey("VOLUME"))
        {
            VOLUME            = PlayerPrefs.GetFloat("VOLUME");
            BarraVolume.value = VOLUME;
        }
        else
        {
            PlayerPrefs.SetFloat("VOLUME", 1);
            BarraVolume.value = 1;
        }
        //=============MODO JANELA===========//
        if (PlayerPrefs.HasKey("modoJanela"))
        {
            modoJanelaAtivo = PlayerPrefs.GetInt("modoJanela");
            if (modoJanelaAtivo == 1)
            {
                Screen.fullScreen    = false;
                CaixaModoJanela.isOn = true;
            }
            else
            {
                Screen.fullScreen    = true;
                CaixaModoJanela.isOn = false;
            }
        }
        else
        {
            modoJanelaAtivo = 0;
            PlayerPrefs.SetInt("modoJanela", modoJanelaAtivo);
            CaixaModoJanela.isOn = false;
            Screen.fullScreen    = true;
        }
        //========RESOLUCOES========//
        if (modoJanelaAtivo == 1)
        {
            telaCheiaAtivada = false;
        }
        else
        {
            telaCheiaAtivada = true;
        }
        if (PlayerPrefs.HasKey("RESOLUCAO"))
        {
            resolucaoSalveIndex = PlayerPrefs.GetInt("RESOLUCAO");
            Screen.SetResolution(resolucoesSuportadas[resolucaoSalveIndex].width, resolucoesSuportadas[resolucaoSalveIndex].height, telaCheiaAtivada);
            Resolucoes.value = resolucaoSalveIndex;
        }
        else
        {
            resolucaoSalveIndex = (resolucoesSuportadas.Length - 1);
            Screen.SetResolution(resolucoesSuportadas[resolucaoSalveIndex].width, resolucoesSuportadas[resolucaoSalveIndex].height, telaCheiaAtivada);
            PlayerPrefs.SetInt("RESOLUCAO", resolucaoSalveIndex);
            Resolucoes.value = resolucaoSalveIndex;
        }
        //=========QUALIDADES=========//
        if (PlayerPrefs.HasKey("qualidadeGrafica"))
        {
            qualidadeGrafica = PlayerPrefs.GetInt("qualidadeGrafica");
            QualitySettings.SetQualityLevel(qualidadeGrafica);
            Qualidades.value = qualidadeGrafica;
        }
        else
        {
            QualitySettings.SetQualityLevel((QualitySettings.names.Length - 1));
            qualidadeGrafica = (QualitySettings.names.Length - 1);
            PlayerPrefs.SetInt("qualidadeGrafica", qualidadeGrafica);
            Qualidades.value = qualidadeGrafica;
        }

        // =========SETAR BOTOES==========//
        //BotaoJogar.onClick = new Button.ButtonClickedEvent();
        //BotaoOpcoes.onClick = new Button.ButtonClickedEvent();
        //BotaoSair.onClick = new Button.ButtonClickedEvent();
        BotaoVoltar.onClick     = new Button.ButtonClickedEvent();
        BotaoSalvarPref.onClick = new Button.ButtonClickedEvent();
        //BotaoJogar.onClick.AddListener(() => Jogar());
        //BotaoOpcoes.onClick.AddListener(() => Opcoes());
        //BotaoSair.onClick.AddListener(() => Sair());
        BotaoVoltar.onClick.AddListener(() => Voltar());
        BotaoSalvarPref.onClick.AddListener(() => SalvarPreferencias());
    }
예제 #10
0
    void Start()
    {
        //Check Player Pref Initalised + Update Player Pref
        if (!PlayerPrefs.HasKey("HR"))
        {
            PlayerPrefs.SetInt("HR", 0);
        }
        if (!PlayerPrefs.HasKey("B"))
        {
            PlayerPrefs.SetInt("B", 1);
        }
        if (!PlayerPrefs.HasKey("CA"))
        {
            PlayerPrefs.SetInt("CA", 1);
        }
        if (!PlayerPrefs.HasKey("LF"))
        {
            PlayerPrefs.SetInt("LF", 0);
        }
        if (!PlayerPrefs.HasKey("MV"))
        {
            PlayerPrefs.SetFloat("MV", 0.7f);
        }
        if (!PlayerPrefs.HasKey("SV"))
        {
            PlayerPrefs.SetFloat("SV", 0.7f);
        }
        if (!PlayerPrefs.HasKey("VN"))
        {
            PlayerPrefs.SetInt("VN", 8);
        }
        PlayerPrefs.Save();

        //Get Game Settings and set them
        GameSettings gameSettings = Game.Settings;

        Game.InitaliseGameSettings(PostProccessingEffects, gameSettings);

        //Facebook Group
        Facebook.onClick.AddListener(OnLoginClick);
        FacebookUser.text = Game.Username != null ? "Welcome " + Game.Username : "******";

        //Main Button Group
        StartButton.onClick.AddListener(OpenModes);
        LeaderboardButton.onClick.AddListener(() => {
            LeanTween.cancelAll(false);
            CloseMain(true);
            OpenLeaderboard();
            LoadLeaderboard();
        });
        SettingsButton.onClick.AddListener(() => {
            LeanTween.cancelAll(false);
            CloseMain();
            OpenSettings();
        });
        ExitButton.onClick.AddListener(() => {
            CloseMain(true);
            CloseParticles();
            LeanTween.delayedCall(1f, Game.Quit);
        });

        //Mode Buttons Group
        ModeCancelButton.onClick.AddListener(() => {
            OpenMain();
            CloseModes();
        });
        ModeClassicButton.onClick.AddListener(() => {
            Game.gameMode = GameMode.Classic;
            CloseMain(true);
            CloseParticles();
            LeanTween.delayedCall(1f, () => { Game.LoadByIndex(1); });
        });
        ModePowerupsButton.onClick.AddListener(() => {
            Game.gameMode = GameMode.Powerups;
            CloseMain(true);
            CloseParticles();
            LeanTween.delayedCall(1f, () => { Game.LoadByIndex(1); });
        });

        //Settings Button Group
        SettingsCancelButton.onClick.AddListener(() => {
            //Reset Toggle Switches
            HalfResolutionToggle.isOn      = gameSettings.HalfResolution;
            BloomToggle.isOn               = gameSettings.Bloom;
            ChromaticAberrationToggle.isOn = gameSettings.ChromaticAberration;

            Game.InitaliseGameSettings(PostProccessingEffects, gameSettings);

            LeanTween.cancelAll(false);
            OpenMain();
            CloseSettings();
        });
        SettingsSaveButton.onClick.AddListener(() => {
            //Take switch states and create new Game Settings and set it
            GameSettings newGameSettings = new GameSettings(
                HalfResolutionToggle.isOn ? 1 : 0,
                BloomToggle.isOn ? 1 : 0,
                ChromaticAberrationToggle.isOn ? 1 : 0,
                LimitFpsToggle ? 1 : 0,
                MusicVolumeSlider.value,
                SoundVolumeSlider.value,
                gameSettings.versionNumber
                );
            Game.Settings = newGameSettings;

            Game.InitaliseGameSettings(PostProccessingEffects, newGameSettings);

            LeanTween.cancelAll(false);
            OpenMain();
            CloseSettings();
        });

        //Settings Options Group
        HalfResolutionToggle.isOn = gameSettings.HalfResolution;
        HalfResolutionToggle.onValueChanged.AddListener((e) => {
            //PostProccessingEffects.HalfResolution = e;
            PostProccessingEffects.Quality = e ? FxProNS.EffectsQuality.Fastest : FxProNS.EffectsQuality.Fast;
            PostProccessingEffects.Init();
        });
        BloomToggle.isOn = gameSettings.Bloom;
        BloomToggle.onValueChanged.AddListener((e) => {
            if (!BloomToggle.isOn && !ChromaticAberrationToggle.isOn)
            {
                PostProccessingEffects.enabled = false;
            }
            else
            {
                PostProccessingEffects.enabled      = true;
                PostProccessingEffects.BloomEnabled = e;
                PostProccessingEffects.Init();
            }
        });
        ChromaticAberrationToggle.isOn = gameSettings.ChromaticAberration;
        ChromaticAberrationToggle.onValueChanged.AddListener((e) => {
            if (!BloomToggle.isOn && !ChromaticAberrationToggle.isOn)
            {
                PostProccessingEffects.enabled = false;
            }
            else
            {
                PostProccessingEffects.enabled             = true;
                PostProccessingEffects.ChromaticAberration = e;
                PostProccessingEffects.Init();
            }
        });
        LimitFpsToggle.isOn     = gameSettings.LimitFps;
        MusicVolumeSlider.value = gameSettings.MusicVolume;
        SoundVolumeSlider.value = gameSettings.SoundVolume;

        //Leaderboard Buttons Group
        LeaderboardCancel.onClick.AddListener(() => {
            LeanTween.cancelAll(false);
            CloseLeaderboard();
            LeanTween.delayedCall(0.8f, () => { OpenMain(); });
        });

        //Find Animatable Objects
        Animatable       = new List <Image>();
        AnimatableLeader = new List <Text>();
        foreach (Image i in GetComponentsInChildren <Image>(true))
        {
            if (i != null && i.tag != "IgnoreUIScan")
            {
                Animatable.Add(i);
            }
        }

        SettingOptions = new Transform[] {
            HalfResolutionToggle.transform,
            BloomToggle.transform,
            ChromaticAberrationToggle.transform,
            LimitFpsToggle.transform,
            MusicVolumeSlider.transform,
            SoundVolumeSlider.transform
        };
        SettingLabels = new Transform[SettingOptions.Length];
        for (int i = 0; i < SettingOptions.Length; i++)
        {
            SettingLabels[i] = SettingOptions[i].parent.GetChild(0);
        }
        LeaderboardElement = Resources.Load <GameObject>("LeaderboardElement");

        //Optimize Scene
        SettingsButtonGroup.SetActive(false);
        SettingsOptionGroup.SetActive(false);

        //Startup Animation
        if (!Application.isEditor && !Game.IntroShown)
        {
            Title.gameObject.SetActive(false);
            Matek.gameObject.SetActive(false);
            Facebook.gameObject.SetActive(false);
            FacebookUser.gameObject.SetActive(false);
            StartButton.gameObject.SetActive(false);
            MainButtonGroup.gameObject.SetActive(false);
            OpenParticles();
        }
    }
예제 #11
0
 public void DefaultSaveSettings()
 {
     PlayerPrefs.SetInt(cSaveMuteKey, volume.mute ? 1 : 0);
     PlayerPrefs.SetFloat(cSaveSeVolumeKey, volume.se);
     PlayerPrefs.SetFloat(cSaveBgmVolumeKey, volume.bgm);
 }
예제 #12
0
 private void ChangeVolume(float value)
 {
     PlayerPrefs.SetFloat("volume", value);
     AudioListener.volume = value * 2;
 }
예제 #13
0
 // Save settings on menu exit
 public void saveSettings()
 {
     PlayerPrefs.SetFloat("musicVol", musicSetter.value / 100);
     PlayerPrefs.SetFloat("sfxVol", sfxSetter.value / 100);
     PlayerPrefs.SetInt("nightMode_" + stateManager.Instance.nightMode, true ? 1 : 0);
 }
예제 #14
0
 public void MouseSensitivity(float sensiti)
 {
     PlayerPrefs.SetFloat("mousesense", sensiti);
     PlayerPrefs.Save();
 }
예제 #15
0
    // Update is called once per frame
    void Update()
    {
        score = getScore();

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene("Title");
        }
        if (bunnyHurtTime == -1)
        {
            if ((Input.GetButtonUp("Jump") || Input.GetButtonUp("Fire1")) && jumpsLeft > 0)
            {
                if (myRigidBody.velocity.y < 0)
                {
                    myRigidBody.velocity = Vector2.zero;
                }
                if (jumpsLeft == 1)
                {
                    myRigidBody.AddForce(transform.up * bunnyJumpForce * 0.75f);
                }
                else
                {
                    myRigidBody.AddForce(transform.up * bunnyJumpForce);
                }
                jumpsLeft--;

                jumpSfx.Play();
            }
            myAnim.SetFloat("vVelocity", myRigidBody.velocity.y);

            scoreText.text = score.ToString("0.0");
        }
        else
        {
            if (Time.time > bunnyHurtTime + 2)
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            }
        }
        if (score <= 5)
        {
            level = 1;
        }
        else if (score > 5 && score < 10)
        {
            level = 2;
        }
        else if (score > 10 && score < 15)
        {
            level = 3;
        }
        else if (score > 15 && score < 20)
        {
            level = 4;
        }
        else if (score > 20 && score < 25)
        {
            level = 5;
        }
        else if (score > 25 && score < 30)
        {
            level = 6;
        }
        else if (score > 30 && score < 35)
        {
            level = 7;
        }
        else if (score > 35 && score < 40)
        {
            level = 8;
        }
        else if (score > 40 && score < 45)
        {
            level = 9;
        }
        else if (score > 50 && score < 55)
        {
            level = 10;
        }
        else if (score > 60 && score < 65)
        {
            level = 11;
        }
        else if (score > 70 && score < 75)
        {
            level = 12;
        }
        else if (score > 80 && score < 85)
        {
            level = 13;
        }
        else if (score > 90 && score < 95)
        {
            level = 14;
        }
        else if (score > 100 && score < 105)
        {
            level = 16;
        }
        else if (score > 110 && score < 115)
        {
            level = 17;
        }
        else if (score > 120 && score < 125)
        {
            level = 18;
        }
        else if (score > 130 && score < 15)
        {
            level = 19;
        }
        else if (score > 140 && score < 145)
        {
            level = 20;
        }



        if (level == 1)
        {
            enableFire(false);
        }
        if (level == 2)
        {
            enableFire(true);
        }

        if (level == 3)
        {
            enableFire(true);
        }

        PlayerPrefs.SetFloat("CurrentScore", score);
        PlayerPrefs.SetInt("CurrentLevel", level);
    }
예제 #16
0
 public void MusicSlider()
 {
     PlayerPrefs.SetFloat("MusicVolume", sliderValue);
 }
예제 #17
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Alpha0))
        {
            state = 0;
        }
        if (Input.GetKeyUp(KeyCode.Alpha1))
        {
            state = 1;
        }
        if (Input.GetKeyUp(KeyCode.Alpha2))
        {
            state = 2;
        }
        if (Input.GetKeyUp(KeyCode.Alpha3))
        {
            state = 3;
        }

        if (Input.GetKeyUp(KeyCode.Alpha4))
        {
            state = 4;
        }

        if (Input.GetKeyUp(KeyCode.S))
        {
            PlayerPrefs.SetFloat("parentPosX", this.transform.parent.localPosition.x);
            PlayerPrefs.SetFloat("parentPosY", this.transform.parent.localPosition.y);
            PlayerPrefs.SetFloat("parentPosZ", this.transform.parent.localPosition.z);
            PlayerPrefs.SetFloat("parentRotY", this.transform.parent.localEulerAngles.y);
            PlayerPrefs.SetFloat("scaleX", scale.x);
            PlayerPrefs.SetFloat("scaleY", scale.y);
            PlayerPrefs.SetFloat("scaleZ", scale.z);
            PlayerPrefs.Save();
        }
        if (Input.GetKeyUp(KeyCode.L))
        {
            this.transform.parent.localPosition = new Vector3(
                PlayerPrefs.GetFloat("parentPosX"),
                PlayerPrefs.GetFloat("parentPosY"),
                PlayerPrefs.GetFloat("parentPosZ"));
            this.transform.parent.localEulerAngles = new Vector3(0, PlayerPrefs.GetFloat("parentRotY"), 0);
            scale.Set(PlayerPrefs.GetFloat("scaleX"), PlayerPrefs.GetFloat("scaleY"), PlayerPrefs.GetFloat("scaleZ"));
            ApplyVectors();
        }

        if (state == 3)
        {
            Vector3 pos = this.transform.parent.localPosition;
            if (Input.GetKey(KeyCode.LeftShift))
            {
                mousePos.Set(pos.x, pos.y + Input.GetAxis("Mouse Y") * translateSpeed, pos.z);
            }
            else
            {
                mousePos.Set(pos.x + Input.GetAxis("Mouse X") * translateSpeed, pos.y, pos.z + Input.GetAxis("Mouse Y") * translateSpeed);
            }

            this.transform.parent.localPosition = mousePos;
        }
        if (state == 1)
        {
            mouseRotateY += Input.GetAxis("Mouse X") * rotateSpeed;
//			float rotation = Input.GetAxis("Horizontal") * rotationSpeed;
            this.transform.parent.localEulerAngles = new Vector3(0, mouseRotateY, 0);
        }
        if (state == 2)
        {
            if (Input.GetKey(KeyCode.LeftShift))
            {
                mouseScale.Set(mouseScale.x, mouseScale.y + Input.GetAxis("Mouse Y") * scaleSpeed, mouseScale.z);
            }
            else
            {
                mouseScale.Set(mouseScale.x + Input.GetAxis("Mouse X") * scaleSpeed, mouseScale.y, mouseScale.z + Input.GetAxis("Mouse Y") * scaleSpeed);
            }
            scale = mouseScale;
            ApplyVectors();
            SetPosition(false);
        }


        if (state == 0)
        {
            ApplyVectors();
            SetPosition(true);
        }
    }
예제 #18
0
 public void SensitivityXSlider()
 {
     PlayerPrefs.SetFloat("XSensitivity", sliderValueXSensitivity);
 }
예제 #19
0
    public void SaveData()
    {
        // Store scene data
        PlayerPrefs.SetString("Current_Scene", SceneManager.GetActiveScene().name);

        // Store player position
        PlayerPrefs.SetFloat("Player_Position_X", PlayerController.instance.transform.position.x);
        PlayerPrefs.SetFloat("Player_Position_Y", PlayerController.instance.transform.position.y);
        PlayerPrefs.SetFloat("Player_Position_Z", PlayerController.instance.transform.position.z);

        // Save Player stats
        for (int i = 0; i < playerStats.Length; i++)
        {
            if (playerStats[i].gameObject.activeInHierarchy)
            {
                PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Active", 1);
            }
            else
            {
                PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Active", 0);
            }

            // Store data for each character object
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Level", playerStats[i].playerLevel);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_MaxLevel", playerStats[i].maxLevel);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_CurrentEXP", playerStats[i].currentEXP);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_CurrentHP", playerStats[i].currentHP);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_CurrentMP", playerStats[i].currentMP);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_MaxHP", playerStats[i].maxHP);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_MaxMP", playerStats[i].maxMP);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_StatPoints", playerStats[i].statPoints);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Strength", playerStats[i].strength);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Vitality", playerStats[i].vitality);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Intelligence", playerStats[i].intelligence);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Dexterity", playerStats[i].dexterity);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_Luck", playerStats[i].luck);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_WeaponPower", playerStats[i].wpnPwr);
            PlayerPrefs.SetInt("Player_" + playerStats[i].charName + "_ArmorPower", playerStats[i].armrPwr);
            PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_HasDied", playerStats[i].hasDied.ToString());

            // Check for nulls
            // Weapon
            if (playerStats[i].equippedWeapon != null)
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedWeapon", playerStats[i].equippedWeapon.itemName);
            }
            else
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedWeapon", "");
            }

            // Armor
            if (playerStats[i].equippedArmor != null)
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedArmor", playerStats[i].equippedArmor.itemName);
            }
            else
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedArmor", "");
            }

            // Shield / off-hand
            if (playerStats[i].equippedShield != null)
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedShield", playerStats[i].equippedShield.itemName);
            }
            else
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedShield", "");
            }

            // Gloves
            if (playerStats[i].equippedGloves != null)
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedGloves", playerStats[i].equippedGloves.itemName);
            }
            else
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedGloves", "");
            }

            // Boots
            if (playerStats[i].equippedBoots != null)
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedBoots", playerStats[i].equippedBoots.itemName);
            }
            else
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedBoots", "");
            }

            // Left accessory
            if (playerStats[i].equippedAccessoryLeft != null)
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedAccessoryLeft", playerStats[i].equippedAccessoryLeft.itemName);
            }
            else
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedAccessoryLeft", "");
            }

            // Right accessory
            if (playerStats[i].equippedAccessoryRight != null)
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedAccessoryRight", playerStats[i].equippedAccessoryRight.itemName);
            }
            else
            {
                PlayerPrefs.SetString("Player_" + playerStats[i].charName + "_EquippedAccessoryRight", "");
            }
        }

        // Store Inventory data
        for (int i = 0; i < playerInventory.Count; i++)
        {
            if (playerInventory[i].item != null)
            {
                PlayerPrefs.SetString("ItemInInventory_" + i, playerInventory[i].item.name);
                PlayerPrefs.SetInt("ItemAmount_" + i, playerInventory[i].amount);
            }
            else
            {
                PlayerPrefs.SetString("ItemInInventory_" + i, "");
                PlayerPrefs.SetInt("ItemAmount_" + i, 0);
            }
        }
    }
예제 #20
0
 public void  SensitivityYSlider()
 {
     PlayerPrefs.SetFloat("YSensitivity", sliderValueYSensitivity);
 }
예제 #21
0
 public void UpdateUIScale()
 {
     UIScale = uiScaleSlider.value;
     PlayerPrefs.SetFloat("UIScale", UIScale);
     UpdateGUI();
 }
예제 #22
0
 public void  SensitivitySmoothing()
 {
     PlayerPrefs.SetFloat("MouseSmoothing", sliderValueSmoothing);
     Debug.Log(PlayerPrefs.GetFloat("MouseSmoothing"));
 }
예제 #23
0
 public void SetVolume(float volume)
 {
     AudioListener.volume = volume;
     PlayerPrefs.SetFloat("Volume", volume);
 }
예제 #24
0
파일: StatIcon.cs 프로젝트: yonasr/mora
    // Update is called once per frame
    void Update()
    {
        //Debug.Log(gold);
        gold_text.text = gold.ToString();
        PlayerPrefs.SetFloat("gold", gold);
        PlayerPrefs.Save();


        hp -= decreasePerMinute * Time.deltaTime / 60f;
        if (healthEvent != null)
        {
            healthEvent.Invoke(hp);
        }

        if (hp <= 0)
        {
            hp = 0;
        }
        else if (hp >= 100.1f)
        {
            hp = 100.1f;
            // fullPanel.gameObject.SetActive(true);
        }
        else if (hp <= 100)
        {
            // fullPanel.gameObject.SetActive(false);
        }

        PlayerPrefs.SetFloat("healthpoint", hp);
        PlayerPrefs.Save();

        if (hp <= 30)
        {
            //myObject.GetComponent<MyScript>().MyFunction();
            spriteRendererhp.sprite = low_hp;
        }
        else if (hp < 100)
        {
            spriteRendererhp.sprite = med_hp;
        }
        else
        {
            spriteRendererhp.sprite = high_hp;
        }

        fun -= decreasePerMinute * Time.deltaTime / 60f;
        if (funEvent != null)
        {
            funEvent.Invoke(fun);
        }

        if (fun <= 0)
        {
            fun = 0;
        }
        else if (fun >= 100.1f)
        {
            fun = 100.1f;
            // fullPanel.gameObject.SetActive(true);
        }
        else if (fun <= 100)
        {
            // fullPanel.gameObject.SetActive(false);
        }

        PlayerPrefs.SetFloat("fun", fun);
        PlayerPrefs.Save();

        // if (FunPointS.fun <= 30)
        // {
        //     //myObject.GetComponent<MyScript>().MyFunction();
        //     spriteRendererfun.sprite = low_fun;
        // }
        // else if (FunPointS.fun < 100)
        // {
        //     spriteRendererfun.sprite = med_fun;
        // }
        // else
        // {
        //     spriteRendererfun.sprite = high_fun;
        // }

        hyg -= decreasePerMinute * Time.deltaTime / 60f;
        if (hygEvent != null)
        {
            hygEvent.Invoke(hyg);
        }

        if (hyg <= 0)
        {
            hyg = 0;
        }
        else if (hyg >= 100.1f)
        {
            hyg = 100.1f;
            // fullPanel.gameObject.SetActive(true);
        }
        else if (hyg <= 100)
        {
            // fullPanel.gameObject.SetActive(false);
        }

        PlayerPrefs.SetFloat("hyg", hyg);
        PlayerPrefs.Save();


        // if (HygPointS.hyg <= 30)
        // {
        //     //myObject.GetComponent<MyScript>().MyFunction();
        //     spriteRendererhealth.sprite = low_hyg;
        // }
        // else if (HygPointS.hyg < 100)
        // {
        //     spriteRendererhealth.sprite = med_hyg;
        // }
        // else
        // {
        //     spriteRendererhealth.sprite = high_hyg;
        // }
    }
예제 #25
0
    public void ClearWayCloud()
    {
        bool  clearway = false;
        float initX    = 0.0f;

        // Verificación de Estados
        int[]   colWeight = new int[powerClouds];
        float[] posWin    = new float[powerClouds];
        for (int i = 0; i < powerClouds; i++)
        {
            for (int j = 0; j < powerClouds; j++)
            {
                if (j == 0)
                {
                    colWeight [i] = 0;
                    posWin [i]    = cloudMatrix [i] [j].transform.position.x;
                }
                colWeight [i] += cloudMatrix [i] [j].GetComponent <CloudBehavior> ().state - 1;
                if (i == powerClouds - 1)
                {
                    if (colWeight [j] == 0)
                    {
                        clearway = true;
                        initX    = posWin [j];
                    }
                }
            }
        }
        if (clearway)
        {
            float gameFactor = 0.0f;
            switch (difficulty)
            {
            case 0:                                             // Facil
                gameFactor = 0.05f;
                gameEasy  += 1;
                break;

            case 1:                                             // medio-facil
                gameFactor  = 0.10f;
                gameMedium += 1;
                break;

            case 2:                                             // medio
                gameFactor  = 0.10f;
                gameMedium += 1;
                break;

            case 3:                                             // dificil
                gameFactor = 0.15f;
                gameHard  += 1;
                break;

            case 4:                                             // hardcore
                gameFactor = 0.15f;
                gameHard  += 1;
                break;
            }
            gameHistory += gameFactor;
            if (gameHistory > 1.0f)
            {
                gameHistory = 1.0f;
            }
            if (gameStat == 2)
            {
                gameStat = 0;
            }
            else
            {
                gameStat += 1;
            }
            PlayerPrefs.SetInt("gamepoints", gamePoints);
            PlayerPrefs.SetFloat("history", gameHistory);
            PlayerPrefs.SetInt("easy", gameEasy);
            PlayerPrefs.SetInt("medium", gameMedium);
            PlayerPrefs.SetInt("hard", gameHard);
            PlayerPrefs.SetInt("stat", gameStat);
            PlayerPrefs.Save();
            GetComponent <TouchControl> ().enabled = false;
            CancelInvoke();
            pereye.PereyeFinalStage(powerClouds, initX, mEndY, mDeltaY);
        }
    }
예제 #26
0
    // Update is called once per frame
    void Update()
    {
        int kik = 0;

        if (kik == 0)
        {
            m_maxHealth    += m_healthBonus;
            m_currentHealth = m_maxHealth;
            kik++;
        }
        timer += Time.deltaTime;
        if (m_currentHealth < 0)
        {
            //died
        }
        string hi = "Health Bonus: " + m_healthBonus.ToString();

        Debug.Log(hi);
        if (timer > 5)
        {
            if (m_currentHealth < m_maxHealth)
            {
                m_currentHealth += (int)(m_maxHealth * m_healthRegen);
                if (m_currentHealth > m_maxHealth)
                {
                    m_currentHealth = m_maxHealth;
                }
            }

            if (m_currentMana < m_maxMana)
            {
                m_currentMana += (int)(m_maxMana * m_ManaRegen);
                if (m_currentMana > m_maxMana)
                {
                    m_currentMana = m_maxMana;
                }
            }
            timer = 0;
        }
        if (m_currentExp >= m_maxExp)
        {
            m_currentLevel++;
            levelPoints  += 6;
            m_currentExp -= m_maxExp;
            m_maxExp     *= 1.5f;
            if (m_currentLevel == 3 || m_currentLevel == 6 || m_currentLevel == 9)
            {
                skillPoints++;
                totalSkillPoints++;
            }
        }
        PlayerPrefs.SetInt("Money", m_moneyAmount);

        PlayerPrefs.SetInt("Money", m_moneyAmount);

        PlayerPrefs.SetInt("HealthPoints", levels[0]);

        PlayerPrefs.SetInt("ManaPoints", levels[1]);

        PlayerPrefs.SetInt("HealthRegenPoints", levels[2]);

        PlayerPrefs.SetInt("ManaRegenPoints", levels[3]);

        PlayerPrefs.SetInt("StrengthPoints", levels[4]);

        PlayerPrefs.SetInt("AttackSpeedPoints", levels[5]);

        PlayerPrefs.SetInt("Skill1", skills[0]);

        PlayerPrefs.SetInt("Skill3", skills[1]);

        PlayerPrefs.SetInt("Skill2", skills[2]);

        PlayerPrefs.SetInt("Level", m_currentLevel);

        PlayerPrefs.SetFloat("EXP", m_currentExp);
    }
예제 #27
0
 public void ChangeSFXVolume()
 {
     sfx.SetFloat("SFX volume", Mathf.Log10(sfxSlider.value) * 20);
     PlayerPrefs.SetFloat("SFXVolume", sfxSlider.value);
 }
예제 #28
0
    void OnGUI()
    {
        EditorGUILayout.LabelField("Player Prefs Editor", EditorStyles.boldLabel);
        EditorGUILayout.Separator();

        fieldType = (FieldType)EditorGUILayout.EnumPopup("Key Type", fieldType);
        setKey    = EditorGUILayout.TextField("Key to Set", setKey);
        setVal    = EditorGUILayout.TextField("Value to Set", setVal);

        if (error != null)
        {
            EditorGUILayout.HelpBox(error, MessageType.Error);
        }

        if (GUILayout.Button("Set Key"))
        {
            if (fieldType == FieldType.Integer)
            {
                int result;
                if (!int.TryParse(setVal, out result))
                {
                    error = "Invalid input \"" + setVal + "\"";
                    return;
                }

                PlayerPrefs.SetInt(setKey, result);
            }
            else if (fieldType == FieldType.Float)
            {
                float result;
                if (!float.TryParse(setVal, out result))
                {
                    error = "Invalid input \"" + setVal + "\"";
                    return;
                }

                PlayerPrefs.SetFloat(setKey, result);
            }
            else
            {
                PlayerPrefs.SetString(setKey, setVal);
            }

            PlayerPrefs.Save();
            error = null;
        }

        if (GUILayout.Button("Get Key"))
        {
            if (fieldType == FieldType.Integer)
            {
                setVal = PlayerPrefs.GetInt(setKey).ToString();
            }
            else if (fieldType == FieldType.Float)
            {
                setVal = PlayerPrefs.GetFloat(setKey).ToString();
            }
            else
            {
                setVal = PlayerPrefs.GetString(setKey);
            }
        }

        if (GUILayout.Button("Delete Key"))
        {
            PlayerPrefs.DeleteKey(setKey);
            PlayerPrefs.Save();
        }

        if (GUILayout.Button("Delete All Keys"))
        {
            PlayerPrefs.DeleteAll();
            PlayerPrefs.Save();
        }
    }
예제 #29
0
 public void ReachedCheckPoint(float x, float y)
 {
     PlayerPrefs.SetFloat("checkPointPositionX", x);
     PlayerPrefs.SetFloat("checkPointPositionY", y);
 }
예제 #30
0
 private void SaveVal(string variableName, float value)
 {
     PlayerPrefs.SetFloat(variableName, value);
     PlayerPrefs.Save();
 }