Пример #1
0
        private void Awake()
        {
            MainReferences.fireTowerManager = this;

            if (BaseProjectiles > AllSettings.Instance.MaxTowerProjectiles)
            {
                BaseProjectiles = AllSettings.Instance.MaxTowerProjectiles;
            }

            #region Copy Base settings to modifiable settings

            Projectiles    = BaseProjectiles;
            Damage         = new BigDouble(BaseDamageDig, BaseDamageExp);
            AttackRange    = BaseRange;
            FireDelay      = BaseFireDelay;
            ExplosionRange = StartingExplosionRange;

            #endregion
            //TODO modify based from save
        }
Пример #2
0
        public void Load()
        {
            BinaryReader r = new BinaryReader(new FileStream(saveFile, FileMode.Open));

#pragma warning disable
            int version = r.ReadInt32();
#pragma warning restore

            EnemyKills            = r.ReadInt32();
            TotalExpGained        = r.ReadInt32();
            WavesCleared          = r.ReadInt32();
            PlayerExp             = new BigDouble(r.ReadDouble(), r.ReadInt64());
            PlayerRankPoints      = new BigDouble(r.ReadDouble(), r.ReadInt64());
            PlayerPremiumCurrency = r.ReadInt64();

            if (r.ReadInt32() == 1)
            {
                PhysicalTowerActive = true;
            }
            else
            {
                PhysicalTowerActive = false;
            }

            if (r.ReadInt32() == 1)
            {
                FireTowerActive = true;
            }
            else
            {
                FireTowerActive = false;
            }

            if (r.ReadInt32() == 1)
            {
                IceTowerActive = true;
            }
            else
            {
                IceTowerActive = false;
            }

            if (r.ReadInt32() == 1)
            {
                LightningTowerActive = true;
            }
            else
            {
                LightningTowerActive = false;
            }

            if (r.ReadInt32() == 1)
            {
                PoisonTowerActive = true;
            }
            else
            {
                PoisonTowerActive = false;
            }

            //Don't remember how to handle increasing enum size etc.
            //Load them into a temp array, compare sizes, copy data to real one.
            //TODO Right array size. Something like if version... resize array after reading to new right size for next save.
            GeneralUpgradeLevels = new int[r.ReadInt32()];
            for (int i = 0; i < GeneralUpgradeLevels.Length; i++)
            {
                GeneralUpgradeLevels[i] = r.ReadInt32();
            }

            r.Close();
        }
Пример #3
0
 public static BigDouble GetNextLevelUpgradeCost(BigDouble initialCost, float costScalePercent, int currentOwned)
 {
     //return initialCost * Mathf.Pow(costScalePercent, currentOwned + 1);
     return initialCost * Mathf.Pow(costScalePercent, currentOwned);
 }
Пример #4
0
 public static BigDouble BulkUpgradeCost(BigDouble nextUpgradeCost, float upgradeScalePercent, int numberToBuy)
 {
     return nextUpgradeCost * ((Mathf.Pow(upgradeScalePercent, numberToBuy) - 1) / (upgradeScalePercent - 1));
 }