Пример #1
0
        public void UpdateUnits(ActualData actualData)
        {
            var processedTowersIds = new HashSet<int>();
            var processedKnightsIds = new HashSet<int>();
            foreach (var actualDataContentItem in actualData.content)
            {
                foreach (var unitData in actualDataContentItem.units)
                {
                    if (unitData.type_unit == UnitType.Tower)
                    {
                        UpdateUnit(_towers, unitData, processedTowersIds);
                    }
                    else
                    {
                        UpdateUnit(_knights, unitData, processedKnightsIds);
                    }
                }
            }

            AdjustFortressHealth(actualData);
            DestroyNotExistedUnits(processedTowersIds, _towers);
            DestroyNotExistedUnits(processedKnightsIds, _knights);
        }
Пример #2
0
 private void AdjustFortressHealth(ActualData actualData)
 {
     var fortressHeath = actualData.content[(int) PlayerRole.Defender].tower_health;
     if (!_isFortressStartHealthSet)
     {
         fortressHealthComponent = _fortress.GetComponent<EnemyHealth>();
         fortressHealthComponent.MaxHealth = fortressHeath;
         _isFortressStartHealthSet = true;
     }
     fortressHealthComponent.SetHealth(fortressHeath);
 }