Ejemplo n.º 1
0
        public void LoadData()
        {
            int cPumpkins = PrefsExtensions.LoadInt(m_dataKey.collectedPumpkinsKey);

            collectedPumpkins = cPumpkins;

            int dFloor = PrefsExtensions.LoadInt(m_dataKey.deepestFloorKey);

            deepestFloor = dFloor;

            int hp = PrefsExtensions.LoadInt(m_dataKey.healthKey);

            if (hp != 0)
            {
                m_Player.health = hp;
            }

            int pArmor = PrefsExtensions.LoadInt(m_dataKey.armorKey);

            m_Player.armor = pArmor;

            int pDmg = PrefsExtensions.LoadInt(m_dataKey.damageKey);

            m_Player.damage = pDmg;

            float spd = PlayerPrefs.GetFloat(m_dataKey.speedKey);

            m_Controller.movementSpeed = spd;
        }
Ejemplo n.º 2
0
 private void AssignData()
 {
     m_deepestFloorText.text    = "Deepest Floor :" + PrefsExtensions.LoadInt("High Score").ToString();
     m_timesDiedText.text       = "Times Died :" + PrefsExtensions.LoadInt("Times Died").ToString();
     m_chestsOpenedText.text    = "Chests Opened :" + PrefsExtensions.LoadInt("Chests Opened").ToString();
     m_potionsConsumedText.text = "Potions consumed :" + PrefsExtensions.LoadInt("Potions Consumed").ToString();
     m_pumpkinsPlacedText.text  = "Pumpkins Planted :" + PrefsExtensions.LoadInt("Pumpkins Placed").ToString();
 }
Ejemplo n.º 3
0
 public void SaveData()
 {
     PrefsExtensions.SaveInt(m_dataKey.collectedPumpkinsKey, collectedPumpkins);
     PrefsExtensions.SaveInt(m_dataKey.deepestFloorKey, deepestFloor);
     PrefsExtensions.SaveInt(m_dataKey.healthKey, m_Player.health);
     PrefsExtensions.SaveInt(m_dataKey.armorKey, m_Player.armor);
     PrefsExtensions.SaveInt(m_dataKey.damageKey, m_Player.damage);
     PlayerPrefs.SetFloat(m_dataKey.speedKey, m_Controller.movementSpeed);
 }
Ejemplo n.º 4
0
        private void ResetStats()
        {
            PrefsExtensions.SaveInt("High Score", 0);
            PrefsExtensions.SaveInt("Times Died", 0);
            PrefsExtensions.SaveInt("Chests Opened", 0);
            PrefsExtensions.SaveInt("Potions Consumed", 0);
            PrefsExtensions.SaveInt("Pumpkins Placed", 0);

            UnityEngine.Debug.Log("Data is gone !");
        }
Ejemplo n.º 5
0
        public void UpdateHighScore()
        {
            // We want to update player's high score when player gets better score.
            // Get the high score from player prefs first.
            int hScore = PrefsExtensions.LoadInt(m_dataKey.highScore);

            // Compare the high score with current floor deep.
            if (deepestFloor > hScore)
            {
                // We got a new high score here.
                // Update the high score.
                PrefsExtensions.SaveInt(m_dataKey.highScore, deepestFloor);
            }
        }
Ejemplo n.º 6
0
            /// <summary>
            /// Detects the current system's resolution and sets it as game's resolution.
            /// </summary>
            public void AutoResolution()
            {
                Window wnd = new Window();

                wnd.Width      = Screen.currentResolution.width;
                wnd.Height     = Screen.currentResolution.height;
                wnd.FullScreen = true;

                Screen.SetResolution(wnd.Width, wnd.Height, wnd.FullScreen);

                // Save resolution into player prefs.
                PrefsExtensions.SaveInt("Width", wnd.Width);
                PrefsExtensions.SaveInt("Height", wnd.Height);
            }
Ejemplo n.º 7
0
        public void UpdatePumpkinsPlacedStatistic()
        {
            int pp = PrefsExtensions.LoadInt(m_dataKey.pumpkinsPlacedKey);

            PrefsExtensions.SaveInt(m_dataKey.pumpkinsPlacedKey, (pp + pumpkinsPlaced));
        }
Ejemplo n.º 8
0
        public void UpdatePotionsConsumedStatistic()
        {
            int pc = PrefsExtensions.LoadInt(m_dataKey.potionsConsumedKey);

            PrefsExtensions.SaveInt(m_dataKey.potionsConsumedKey, (pc + potionsConsumed));
        }
Ejemplo n.º 9
0
        public void UpdateChestStatistic()
        {
            int co = PrefsExtensions.LoadInt(m_dataKey.chestsOpenedKey);

            PrefsExtensions.SaveInt(m_dataKey.chestsOpenedKey, (co + chestsOpened));
        }
Ejemplo n.º 10
0
        public void UpdateDiedTimesStatistic()
        {
            int dt = PrefsExtensions.LoadInt(m_dataKey.timesDiedKey);

            PrefsExtensions.SaveInt(m_dataKey.timesDiedKey, (dt + 1));
        }
Ejemplo n.º 11
0
            /// <summary>
            /// Enables us to get height of screen.
            /// </summary>
            /// <returns> Height of screen. </returns>
            public static int GetHeight()
            {
                int h = PrefsExtensions.LoadInt("Height");

                return(h);
            }
Ejemplo n.º 12
0
            /// <summary>
            /// Enables us to get width of screen.
            /// </summary>
            /// <returns> Width of screen. </returns>
            public static int GetWidth()
            {
                int w = PrefsExtensions.LoadInt("Width");

                return(w);
            }