46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public class GrasFieldManager : MonoBehaviour
|
|
{
|
|
public List<GrasFeld> alleFelder;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void UpdateChunks()
|
|
{
|
|
transform.GetChild(0).GetComponent<GrasFeld>().MakeChunks();
|
|
}
|
|
|
|
|
|
public void BrushGras(Terrain terrain, GrassortenScriptableObject grassorte, Vector2 pos, float radius, bool shift)
|
|
{
|
|
if (alleFelder.Count > 0) alleFelder[0].GrasZeichnen(grassorte, pos * new Vector2(terrain.terrainData.size.x, terrain.terrainData.size.z), radius, shift);
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
public void ClearChunks()
|
|
{
|
|
while (transform.GetChild(0).childCount > 0)
|
|
{
|
|
transform.GetChild(0).GetComponent<GrasFeld>().ClearAllChunkData();
|
|
transform.GetChild(0).GetComponent<GrasFeld>().AlleChunkObjekte.Clear();
|
|
DestroyImmediate(transform.GetChild(0).GetChild(0).gameObject);
|
|
}
|
|
}
|
|
#endif
|
|
}
|