grass-rendering-prototype/Assets/TerrainTool/GrasFieldManager.cs
2025-09-02 15:42:46 +02:00

55 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class GrasFieldManager : MonoBehaviour
{
public List<GrasJob> alleJobs = new List<GrasJob>();
public GrasJob currentJob;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void GetAllJobs()
{
alleJobs.Clear();
for(int i=0; i < transform.childCount; i++)
{
alleJobs.Add(transform.GetChild(i).GetComponent<GrasJob>());
}
}
public void BrushGras(Terrain terrain, GrassortenScriptableObject grassorte, Vector2 pos, float radius, bool shift)
{
if(currentJob == null)
{
GetAllJobs();
if(alleJobs.Count > 0)
currentJob = alleJobs[0];
}
if (currentJob == null) return;
Debug.Log(pos);
}
public void ClearChunks()
{
while (transform.childCount > 0)
{
DestroyImmediate(transform.GetChild(0).gameObject);
}
}
}