Пример #1
0
 //武器降级
 public void OnMinusGun()
 {
     if (currentGun)
     {
         GunAttr oGunAttr = currentGun.GetComponent <GunAttr>();
         bool    bMinus   = oGunAttr.MinusPower();
         if (bMinus)
         {
             _currentPowerIndex--;
         }
         else
         {
             _gunIndex--;
             if (_gunIndex < 0)
             {
                 _gunIndex = m_GunArrays.Length - 1;
                 if (currentMaxPowerIndex > 0)
                 {
                     _currentPowerIndex = currentMaxPowerIndex - 1;
                 }
                 else
                 {
                     _currentPowerIndex = 0;
                 }
             }
             else
             {
                 _currentPowerIndex--;
             }
             currentGun.GetComponent <GunAttr>().initMaxPower();
             switchGun();
         }
         swithGunCost();
     }
 }
Пример #2
0
 //武器提升
 public void OnUpgradeGun()
 {
     if (currentGun)
     {
         GunAttr oGunAttr = currentGun.GetComponent <GunAttr>();
         bool    bUpgrade = oGunAttr.AddPower();
         //当前枪切升级威力成功
         if (bUpgrade)
         {
             _currentPowerIndex++;
         }
         else
         {
             //当前枪已经是最大威力,换枪
             _gunIndex++;
             if (_gunIndex >= m_GunArrays.Length)
             {
                 _gunIndex          = 0;
                 _currentPowerIndex = 0;
             }
             else
             {
                 _currentPowerIndex++;
             }
             currentGun.GetComponent <GunAttr>().initMinPower();
             switchGun();
         }
         swithGunCost();
     }
 }