예제 #1
0
        void Update()
        {
            WorldPointContinents.Clear();
            foreach (GameObject go in gos)
            {
                Destroy(go);
            }
            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    WorldPointContinents.Add(new Vector2(x, y), new WorldPointContinent(new Vector2(x, y)));
                }
            }
            CreateContinents();
            Dictionary <Vector2, float> md = MantleData.GetData(0, octaves, lac, pers, multi, Height, Width, zoom);;

            foreach (Continent c in Continents)
            {
                foreach (ContinentPoint cp in c.Points.Values)
                {
                    WorldPointContinent wp = c.ContinentPointToWorldPoint(cp, this);
                    float val = md[wp.Pos];
                    if (val < 0.12f)
                    {
                        cp.height = 0;
                    }
                    else if (val < 0.25f)
                    {
                        cp.height = 1;
                    }
                    else if (val < 0.37f)
                    {
                        cp.height = 2;
                    }
                    else if (val < 0.5f)
                    {
                        cp.height = 3;
                    }
                    else if (val < 0.62f)
                    {
                        cp.height = 4;
                    }
                    else if (val < 0.75f)
                    {
                        cp.height = 5;
                    }
                    else if (val < 0.87f)
                    {
                        cp.height = 6;
                    }
                    else
                    {
                        cp.height = 8;
                    }
                }
            }
            ColorMap();
        }
        // Start is called before the first frame update
        void Start()
        {
            md = new MantleData();
            bool booleanCheck = new Vector2(0, 1) == new Vector2(0, 1);

            for (int x = 0; x < 100; x++)
            {
                for (int y = 0; y < 100; y++)
                {
                    WorldPoints.Add(new Vector2(x, y), new WorldPoint(new Vector2(x, y)));
                }
            }
            CreateVoronoi();
        }