void Generate()
    {
        if (mappedSources != null)
        {
            mappedSources.Clear();
        }
        if (sources != null)
        {
            sources.Clear();
        }
        // Prepare data repos
        sources       = new List <ShipSource>();
        mappedSources = new MeshObjectMap <ShipSource>();

        // Add data
        sources.Add(new ShipSource(data));

        // Generate Object and Mesh
        foreach (ShipSource source in sources)
        {
            mappedSources.NewObject(source, new Vector3(0f, 0f, 0f));
            source.Generate();
        }

        // Apply meshes to objects
        if (mappedSources != null)
        {
            mappedSources.UpdateAllMeshes();
        }
    }
    private void Awake()
    {
        waveData      = new WaveData(waterMat);
        waterSource   = new WaterSource();
        mappedSources = new MeshObjectMap <WaterSource>();

        mappedSources.NewObject(waterSource, Vector3.zero);
        waterSource.GenerateRange(Vector3.zero, 1024f, 64, waterMat);
        mappedSources.UpdateAllMeshes();
        // Create wave data based on water material
        GameObject baseobject = mappedSources.GetMapped(waterSource);

        for (int i = -3; i < 4; i++)
        {
            for (int j = -3; j < 4; j++)
            {
                if (!(i == 0 && j == 0))
                {
                    GameObject.Instantiate(baseobject, new Vector3(1024f * i, 0f, 1024f * j), Quaternion.identity);
                }
            }
        }
    }