示例#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());
        }
示例#2
0
 /// <summary>
 /// Get next shield data by level
 /// </summary>
 /// <param name="lvl"></param>
 /// <returns></returns>
 public static Shield GetNextShieldDataByLvl(int lvl)
 {
     if (lvl == DataBank.GetShieldData().OrderByDescending(x => x.Key).First().Key)
     {
         return(new Shield(-1, -1));
     }
     return(DataBank.GetShieldData()[lvl + 1]);
 }
示例#3
0
 /// <summary>
 /// Get Shield Cost
 /// </summary>
 /// <param name="curLevel"></param>
 /// <returns></returns>
 int GetNextShieldCost(int curLevel)
 {
     if (curLevel == DataBank.GetShieldData().OrderByDescending(x => x.Value.Cost).First().Key)
     {
         return(-1);
     }
     return(DataBank.GetShieldData()[curLevel + 1].Cost);
 }
示例#4
0
        /// <summary>
        /// Get Shield infomation text
        /// </summary>
        /// <param name="currentLvl"></param>
        /// <returns></returns>
        string GetShieldInfoText(int currentLvl)
        {
            int shieldLvl  = GetCurrentShieldLevel(GameManager.Instance.GetCurrentShield().Duration);
            int shieldCost = GetNextShieldCost(shieldLvl);

            if (currentLvl == DataBank.GetShieldData().OrderByDescending(x => x.Key).First().Key)
            {
                m_ShieldBtn.interactable = false;
                return("<color=#fd0000>Already Upgraded to MAX level</color>");
            }
            return("<color=#cfd2d4> Upgrade to " + DataBank.GetShieldData()[(currentLvl + 1)].Duration + " sec. for :</color>" +
                   GetCostString(shieldCost));
        }
示例#5
0
 /// <summary>
 /// Get Current shiled level by duration
 /// </summary>
 /// <param name="duration"></param>
 /// <returns></returns>
 public static int GetCurrentShieldLevel(int duration)
 {
     return(DataBank.GetShieldData().FirstOrDefault(x => x.Value.Duration == duration).Key);
 }