NLDClient-yudde/ProjectNLD/Assets/ThirdParty/TerrainGridSystem/Scripts/Snippets/TGSClearCells.cs

36 lines
728 B
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace TGS {
[AddComponentMenu ("Kronnect/Terrain Grid System/TGS Clear Cells")]
public class TGSClearCells : TGSSnippetBase {
public bool clearAll;
public int radius;
protected override void Configure () {
instructions = "Remove colors on cells.";
supportsTweening = false;
}
protected override void Execute (float t) {
if (clearAll) {
tgs.ClearAll ();
} else {
Cell cell = tgs.CellGetAtPosition (transform.position, true);
if (cell == null) {
return;
}
List<int> indices = tgs.CellGetNeighbours (cell, radius);
indices.Add (cell.index);
tgs.CellClear (indices);
}
}
}
}