Exemplo n.º 1
0
        internal static UpgradeTemplate CreateVeterancyUpgradeTemplate(VeterancyLevel veterancyLevel)
        {
            var result = new UpgradeTemplate
            {
                Type = UpgradeType.Object
            };

            result.SetNameAndInstanceId("Upgrade", $"Upgrade_Veterancy_{veterancyLevel.ToString().ToUpperInvariant()}");

            return(result);
        }
Exemplo n.º 2
0
        private (int, float) GetCountAndProgress(UpgradeTemplate upgradeTemplate)
        {
            var progress   = 0.0f;
            var count      = _productionQueue.Where(x => x.UpgradeDefinition != null && upgradeTemplate.Name == x.UpgradeDefinition.Name).Count();
            var currentJob = _productionQueue[0];

            if (currentJob.UpgradeDefinition != null && upgradeTemplate.Name == currentJob.UpgradeDefinition.Name)
            {
                progress = currentJob.Progress;
            }

            return(count, progress);
        }
Exemplo n.º 3
0
        internal void CancelUpgrade(UpgradeTemplate upgradeDefinition)
        {
            var index = -1;

            for (var i = 0; i < _productionQueue.Count; i++)
            {
                if (_productionQueue[i].UpgradeDefinition == upgradeDefinition)
                {
                    index = i;
                }
            }

            if (index < 0 || index > _productionQueue.Count)
            {
                return;
            }

            _productionQueue.RemoveAt(index);
        }
Exemplo n.º 4
0
        internal void QueueUpgrade(UpgradeTemplate upgradeDefinition)
        {
            var job = new ProductionJob(upgradeDefinition);

            _productionQueue.Add(job);
        }
Exemplo n.º 5
0
 private void GrantUpgrade(UpgradeTemplate upgradeDefinition)
 {
     _gameObject.Upgrade(upgradeDefinition);
 }
Exemplo n.º 6
0
 public Upgrade(UpgradeTemplate template)
 {
     Template = template;
 }
Exemplo n.º 7
0
 private static void CreateVeterancyUpgrade(AssetStore assetStore, VeterancyLevel veterancyLevel)
 {
     assetStore.Upgrades.Add(UpgradeTemplate.CreateVeterancyUpgradeTemplate(veterancyLevel));
 }