Example #1
0
    void CreateChunks()
    {
        var generator = new MeshGenerator(maxHeight, maxMaterials, heightMap, heightColors, heightWaterColors, transform.position,
                                          newGraph, GetComponent <MeshFilter>(), GetComponent <MeshRenderer>(), waterLevel);

        generator.Create();
    }
Example #2
0
    private void SpawnBoids()
    {
        for (int i = 0; i < boidAmount; i++)
        {
            BoidBase newBoid = default;

            Vector3    randomPos   = RandomPos(cageSize);
            Quaternion randomRot   = RandomRot();
            int        randomIndex = Random.Range(0, boidPrefabs.Length);

            switch (mode)
            {
            case MODE.None:
                GameObject newBoidObject = MeshGenerator.Create(MeshGenerator.SHAPE.Cube, randomPos, randomRot, 1.5f);
                newBoid = newBoidObject.AddComponent(typeof(Boid)) as Boid;

                switch (randomIndex)
                {
                case 0:
                    ((Boid)newBoid).SetSharedData("Flamingo", ENDANGERED_STATUS.VU);
                    break;

                case 1:
                    ((Boid)newBoid).SetSharedData("Shorebird", ENDANGERED_STATUS.EN);
                    break;

                case 2:
                    ((Boid)newBoid).SetSharedData("Starling", ENDANGERED_STATUS.CR);
                    break;
                }
                break;

            case MODE.Prefab:
                newBoid = Instantiate(boidPrefabs[randomIndex], randomPos, randomRot).GetComponent <BoidBase>();
                break;

            case MODE.Scriptable_Prefab:
                newBoid = Instantiate(boidScriptablePrefabs[randomIndex], randomPos, randomRot).GetComponent <BoidBase>();
                break;
            }
            boids.Add(newBoid);
        }
    }