Exemplo n.º 1
0
        /// <summary>
        /// Initialized the shop data
        /// </summary>
        void Init()
        {
            int coinsInHand = GameManager.Instance.GetCoinsInHand();

            m_ShooterAmor = GameManager.Instance.GetCurrentAmorData();

            m_Coins.text = coinsInHand.ToString();

            int nextGunPowerCost   = GetNextGunCost(m_ShooterAmor.GunLevel);
            int nextMissileMagCost = GetNextMissileMagazineCost(m_ShooterAmor.MissileMagazineLvl);


            //////
            // Set Gun Power Related Stuff
            //////
            m_GunPowerSlider.maxValue    = DataBank.GetGunPowerData().Count();
            m_GunPowerSlider.value       = m_ShooterAmor.GunLevel;
            m_GunUpgradeBtn.interactable = SetButtonIntractable(nextGunPowerCost, coinsInHand);
            m_GunPowerInfo.text          = GetGunPowerInfoText(m_ShooterAmor.GunLevel);

            //////
            // Set Missile Magazine Related Stuff
            //////
            m_MagazineSlider.maxValue       = DataBank.GetMissileMagazineData().Count();
            m_MagazineSlider.value          = m_ShooterAmor.MissileMagazineLvl;
            m_MagazineUpgrdBtn.interactable = SetButtonIntractable(nextMissileMagCost, coinsInHand);
            m_MagazineInfo.text             = GetMagazineInfoText(m_ShooterAmor.MissileMagazineLvl);

            //////
            // Set Missile Related Stuff
            //////
            int missileCount = m_ShooterAmor.MissileCount;
            int missileCap   = m_ShooterAmor.MagazineCapacity;

            m_MissileSlider.maxValue     = missileCap;
            m_MissileSlider.value        = missileCount;
            m_MissileCount.text          = "Missile Count:" + missileCount + "/" + missileCap;
            m_MissileAddBtn.interactable = SetButtonIntractable(m_MissileCost, coinsInHand);
            m_MissileInfoText.text       = GetMissileCapacityInfoText();


            //////
            // Set Shield Related Stuff
            //////
            int shieldLvl  = GetCurrentShieldLevel(GameManager.Instance.GetCurrentShield().Duration);
            int shieldCost = GetNextShieldCost(shieldLvl);

            m_ShiledSlider.maxValue  = DataBank.GetShieldData().Count();
            m_ShiledSlider.value     = shieldLvl;
            m_ShieldInfo.text        = GetShieldInfoText(shieldLvl);
            m_ShieldBtn.interactable = SetButtonIntractable(shieldCost, coinsInHand);

            //////
            // Set Life Related Stuff
            //////
            m_LifeSlider.value     = GameManager.Instance.LifesLeft();
            m_LifeBtn.interactable = SetButtonIntractable(m_LifeCost, coinsInHand);
            m_LifeInfo.text        = GetLifeInfoText(GameManager.Instance.LifesLeft());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get next gun level
 /// </summary>
 /// <param name="lvl"></param>
 /// <returns></returns>
 public static int GetNextGunLevel(int lvl)
 {
     if (lvl == DataBank.GetGunPowerData().OrderByDescending(x => x.Key).First().Key)
     {
         return(-1);
     }
     return(lvl + 1);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get the next gun levels cost
 /// </summary>
 /// <param name="curLevel"></param>
 /// <returns></returns>
 int GetNextGunCost(int curLevel)
 {
     if (curLevel == DataBank.GetGunPowerData().OrderByDescending(x => x.Value).First().Key)
     {
         return(-1);
     }
     return(DataBank.GetGunPowerData()[curLevel + 1]);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Get the gun upgrade cost
        /// </summary>
        /// <param name="lvl"></param>
        /// <returns></returns>
        public static int GetGunUpgradeCost(int lvl)
        {
            if (DataBank.GetGunPowerData().ContainsKey(lvl))
            {
                return(DataBank.GetGunPowerData()[lvl]);
            }

            return(-1);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Get the gun power information text
 /// </summary>
 /// <param name="currentLvl"></param>
 /// <returns></returns>
 string GetGunPowerInfoText(int currentLvl)
 {
     if (currentLvl == DataBank.GetGunPowerData().OrderByDescending(x => x.Value).First().Key)
     {
         m_GunUpgradeBtn.interactable = false;
         return("<color=#fd0000>Already Upgraded to MAX level</color>");
     }
     return("<color=#cfd2d4> Upgrade to Lvel " + (currentLvl + 1) + " for: </color>" +
            GetCostString(DataBank.GetGunPowerData()[currentLvl + 1]));
 }