Exemplo n.º 1
0
        private float DetermineTemperature(HexCell cell)
        {
            float latitude = (float)cell.coordinates.Z / grid.cellCountZ;

            if (hemisphere == HemisphereMode.Both)
            {
                latitude *= 2f;
                if (latitude > 1f)
                {
                    latitude = 2f - latitude;
                }
            }
            else if (hemisphere == HemisphereMode.North)
            {
                latitude = 1f - latitude;
            }

            float temperature =
                Mathf.LerpUnclamped(lowTemperature, highTemperature, latitude);

            temperature *= 1f - (cell.ViewElevation - waterLevel) /
                           (elevationMaximum - waterLevel + 1f);

            float jitter =
                HexMetrics.SampleNoise(cell.Position * 0.1f)[temperatureJitterChannel];

            temperature += (jitter * 2f - 1f) * temperatureJitter;

            return(temperature);
        }
Exemplo n.º 2
0
        private void RefreshPosition()
        {
            Vector3 position = transform.localPosition;

            position.y  = elevation * HexMetrics.elevationStep;
            position.y += (HexMetrics.SampleNoise(position).y * 2f - 1f) * HexMetrics.elevationPerturbStrength;
            transform.localPosition = position;

            Vector3 uiPosition = uiRect.localPosition;

            uiPosition.z         = -position.y;
            uiRect.localPosition = uiPosition;
        }
Exemplo n.º 3
0
        void RefreshPosition()
        {
            // Change cell position according to elevation
            Vector3 position = transform.localPosition;

            position.y  = elevation * HexMetrics.elevationStep;
            position.y += (HexMetrics.SampleNoise(position).y * 2f - 1f) * HexMetrics.elevationPerturbationStrength; // Perturbation for cell elevation
            transform.localPosition = position;
            // Also change ui position
            Vector3 uiPosition = uiRect.localPosition;

            uiPosition.z         = -position.y;
            uiRect.localPosition = uiPosition;
        }