private void LateUpdate()
    {
        if (globalMap == null)
        {
            return;
        }
        float t         = Time.deltaTime * GameMaster.gameSpeed,
              ascension = globalMap.ascension;

        ;

        //wind:
        {
            windTimer -= t;
            if (windTimer <= 0)
            {
                windTimer     = WIND_CHANGE_TIME * (0.1f + Random.value * 1.9f);
                newWindVector = Quaternion.AngleAxis((0.5f - Random.value) * 30, Vector3.up) * windVector;
                newWindVector = newWindVector * (1 + (0.5f - Random.value) * 0.5f);
            }
            if (windVector != newWindVector)
            {
                float st = WIND_CHANGE_STEP * t;
                windVector = Vector3.RotateTowards(windVector, newWindVector, st, st);
                float windpower = windVector.magnitude;
                Shader.SetGlobalFloat(vegetationShaderWindPropertyID, windpower);
                if (WindUpdateEvent != null)
                {
                    WindUpdateEvent(windVector);
                }
            }
        }
        //env
        if (envLerpSpeed != 0f)
        {
            if (currentEnvironment != targetEnvironment)
            {
                currentEnvironment = currentEnvironment.ConvertTo(targetEnvironment, envLerpSpeed * t);
                RefreshVisual();
            }
            else
            {
                Debug.Log("env master - visual changes completed");
                envLerpSpeed = 0f;
            }
        }
        //
        if (GameMaster.realMaster.gameMode != GameMode.Editor & !GameMaster.loading)
        {
            //if (currentEnvironment.presetType != Environment.EnvironmentPresets.Default)
            //{
            if (environmentEventTimer > 0)
            {
                environmentEventTimer -= t;
                if (environmentEventTimer <= 0)
                {
                    //currentEnvironment.InnerEvent();
                    // environmentEventTimer = currentEnvironment.GetInnerEventTime();
                }
            }
            //}

            var dir = globalMap.cityFlyDirection / 500f;
            dir.y = 0;
            if (decorations.Count > 0)
            {
                int     i = 0;
                Vector3 pos;
                float   sqrRadius = SKY_SPHERE_RADIUS * SKY_SPHERE_RADIUS;
                while (i < decorations.Count)
                {
                    pos  = decorations[i].position;
                    pos += dir;
                    decorations[i].position = pos;
                    if (Vector3.SqrMagnitude(pos) > sqrRadius * 4f)
                    {
                        Destroy(decorations[i].gameObject);
                        decorations.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
            }
            if (lastSpawnDistance > 0)
            {
                lastSpawnDistance -= dir.magnitude;
            }

            if (showCelestialBodies)
            {
                if (celestialBodies != null && celestialBodies.Count > 0)
                {
                    Vector3 cpoint = Quaternion.AngleAxis(globalMap.cityPoint.angle, Vector3.back) * (Vector3.up * globalMap.cityPoint.height);
                    Vector3 mpoint;
                    foreach (var sb in celestialBodies)
                    {
                        mpoint            = Quaternion.AngleAxis(sb.Key.angle, Vector3.back) * (Vector3.up * sb.Key.height);
                        mpoint           -= cpoint;
                        mpoint.z          = mpoint.y * 10f; mpoint.x *= 10f;
                        mpoint.y          = 1f;
                        sb.Value.position = mpoint;
                    }
                }
            }

            #region  test lightnings
            if (lightning)
            {
                effectsTimer -= t;
                if (effectsTimer < 0)
                {
                    float f      = Chunk.chunkSize;
                    var   center = GameMaster.sceneCenter;
                    var   pos    = Random.onUnitSphere * f + center;
                    dir  = center - pos;
                    dir += Random.onUnitSphere;
                    RaycastHit rh;
                    if (Physics.Raycast(pos, dir, out rh, 2 * f))
                    {
                        Lightning.Strike(pos, rh.point);
                        var   hitobject = rh.collider;
                        float damage    = Lightning.CalculateDamage();
                        if (hitobject.tag == Structure.STRUCTURE_COLLIDER_TAG)
                        {
                            hitobject.transform.parent.GetComponent <Structure>().ApplyDamage(damage);
                        }
                        else
                        {
                            if (hitobject.tag == Chunk.BLOCK_COLLIDER_TAG)
                            {
                                var crh = GameMaster.realMaster.mainChunk.GetBlock(rh.point, rh.normal);
                                crh.block?.EnvironmentalStrike(crh.faceIndex, rh.point, 2, damage);
                            }
                        }
                    }
                    else
                    {
                        var end = pos + Random.onUnitSphere * 5f;
                        end.y = GameConstants.GetBottomBorder();
                        Lightning.Strike(pos, end);
                    }
                    effectsTimer = 1f;
                }
            }
            #endregion
            //sunlight changing
            var clv = globalMap.cityLookVector * -1f;
            clv.y = -0.3f;
            //var rightVector = Vector3.Cross(clv, Vector3.down);
            // sunTransform.forward = Quaternion.AngleAxis(15f + ascension * 75f ,rightVector) * clv;
            sunTransform.forward = clv;

            #region stability
            if (colonyController != null)
            {
                float hc = 1f, gc = 0f;
                hc = colonyController.happinessCoefficient;
                if (colonyController.storage != null)
                {
                    gc = colonyController.storage.GetResourceCount(ResourceType.Graphonium) / GameConstants.GRAPHONIUM_CRITICAL_MASS;

                    // + блоки?
                }
                float pc  = 0f;
                int   pop = colonyController.citizenCount;
                if (pop > POPULATION_CONDITION_1)
                {
                    if (pop >= POPULATION_CONDITION_3)
                    {
                        pc = POPULATION_STABILITY_EFFECT_3;
                    }
                    else
                    {
                        if (pop > POPULATION_CONDITION_2)
                        {
                            pc = POPULATION_STABILITY_EFFECT_2;
                        }
                        else
                        {
                            pc = POPULATION_STABILITY_EFFECT_1;
                        }
                    }
                }

                float structureStabilizersEffect = 1f;
                if (stabilityModifiers != null && stabilityModifiers.Count > 0)
                {
                    structureStabilizersEffect = 1f;
                    foreach (var sm in stabilityModifiers)
                    {
                        structureStabilizersEffect *= (1f + sm.Value);
                    }
                }
                targetStability =
                    (
                        0.5f * hc // happiness
                        - gc      // graphonium reserves
                        + pc      // population
                        + (1f - ascension) * structureStabilizersEffect
                    )
                    *
                    currentEnvironment.stability;
                if (targetStability > 1f)
                {
                    targetStability = 1f;
                }
                else
                {
                    if (targetStability < 0f)
                    {
                        targetStability = 0f;
                    }
                }
                if (islandStability != targetStability)
                {
                    islandStability = Mathf.MoveTowards(islandStability, targetStability, GameConstants.STABILITY_CHANGE_SPEED * Time.deltaTime);
                }
                if (islandStability < 1f)
                {
                    float lcf  = colonyController.GetLevelSoftingCf();
                    float step = lcf > 1f ? 0f : CITY_CHANGE_HEIGHT_STEP * (1f - islandStability) * t * (1f - lcf);
                    if (step != 0f)
                    {
                        if (ascension < 0.5f)
                        {
                            if (globalMap.cityPoint.height != 1f)
                            {
                                globalMap.ChangeCityPointHeight(step);
                                positionChanged = true;
                            }
                        }
                        else
                        {
                            if (globalMap.cityPoint.height != 0f)
                            {
                                globalMap.ChangeCityPointHeight(-step);
                                positionChanged = true;
                            }
                        }
                    }
                }
            }
            // обновление освещения при движении города
            if (positionChanged)
            {
                RefreshVisual();
            }
            #endregion
        }
    }