예제 #1
0
 private void InitializeStats()
 {
     foreach (Equipment eq in PlayerManager.instance.equipment)
     {
         if (eq is WeaponEquipment)
         {
             WeaponEquipment     w  = eq as WeaponEquipment;
             WeaponUpgradeStruct wu = new WeaponUpgradeStruct(800, 1, w.damage, w.inaccuracy, w.fireRate, w.range);
             wu.Upgrade();
             upgradeStructs.Add(wu);
             structVals.Add(0);
         }
         else if (eq is StorageEquipment)
         {
             StorageEquipment     s  = eq as StorageEquipment;
             StorageUpgradeStruct su = new StorageUpgradeStruct(700, 1, s.capacity);
             su.Upgrade();
             upgradeStructs.Add(su);
             structVals.Add(1);
         }
         else if (eq is EnergyEquipment)
         {
             EnergyEquipment     e  = eq as EnergyEquipment;
             EnergyUpgradeStruct ee = new EnergyUpgradeStruct(850, 1, e.energyCapacity);
             ee.Upgrade();
             upgradeStructs.Add(ee);
             structVals.Add(2);
         }
         else if (eq is TransmitterEquipment)
         {
             TransmitterEquipment t  = eq as TransmitterEquipment;
             TransUpgradeStruct   tu = new TransUpgradeStruct(700, 1, t.uploadFactor);
             tu.Upgrade();
             upgradeStructs.Add(tu);
             structVals.Add(3);
         }
         else
         {
             ResearchEquipment     r  = eq as ResearchEquipment;
             ResearchUpgradeStruct ru = new ResearchUpgradeStruct(750, 1, r.scanTime, r.range);
             ru.Upgrade();
             upgradeStructs.Add(ru);
             structVals.Add(4);
         }
     }
 }
예제 #2
0
    public void UpdateUpgrades(int index)
    {
        int structType = structVals[index];

        if (structType == 0)
        {
            WeaponUpgradeStruct wu = (WeaponUpgradeStruct)upgradeStructs[index];
            wu.Upgrade();
            upgradeStructs[index] = wu;
            upgrades[index]       = new WeaponUpgrade(
                wu.cost, wu.levelUpgrade, wu.damageUpgrade, wu.inaccuracryUpgrade, wu.fireRateUpgrade, wu.rangeUpgrade);
        }
        else if (structType == 1)
        {
            StorageUpgradeStruct su = (StorageUpgradeStruct)upgradeStructs[index];
            su.Upgrade();
            upgradeStructs[index] = su;
            upgrades[index]       = new StorageUpgrade(
                su.cost, su.levelUpgrade, su.capacityUpgrade);
        }
        else if (structType == 2)
        {
            EnergyUpgradeStruct eu = (EnergyUpgradeStruct)upgradeStructs[index];
            eu.Upgrade();
            upgradeStructs[index] = eu;
            upgrades[index]       = new EnergyUpgrade(
                eu.cost, eu.levelUpgrade, eu.energyCapacityUpgrade);
        }
        else if (structType == 3)
        {
            TransUpgradeStruct tu = (TransUpgradeStruct)upgradeStructs[index];
            tu.Upgrade();
            upgradeStructs[index] = tu;
            upgrades[index]       = new TransmitterUpgrade(
                tu.cost, tu.levelUpgrade, tu.uploadFactorUpgrade);
        }
        else
        {
            ResearchUpgradeStruct ru = (ResearchUpgradeStruct)upgradeStructs[index];
            ru.Upgrade();
            upgradeStructs[index] = ru;
            upgrades[index]       = new ResearchUpgrade(
                ru.cost, ru.levelUpgrade, ru.scanTimeUpgrade, ru.scanRangeUpgrade);
        }
    }