예제 #1
0
        void BuildLandscape()
        {
            for (int x = -dimentions.x; x < dimentions.x; x++)
            {
                for (int y = -dimentions.y; y < dimentions.y; y++)
                {
                    // empty space for roads
                    if (x % blockDimentions.x == 0 || y % blockDimentions.y == 0)
                    {
                        continue;
                    }

                    if (UnityEngine.Random.Range((float)0.0f, (float)1.0) < landscapeDensityFactor)
                    {
                        float height       = towerHeight.GetRandom();
                        float heightFactor = towerHeight.InvLerp(height);
                        Color color        = towerColorRangeBasedOnHeight.Lerp(heightFactor);
                        CreateATower(new Vector2Int(x, y), height, color);
                    }
                }
            }
        }