改了格子大小

This commit is contained in:
tangbin
2025-07-25 15:36:10 +08:00
parent 5d63e4878c
commit f88a2e9504
1009 changed files with 69967 additions and 81 deletions

View File

@@ -29,9 +29,9 @@ public class GridSelector : MonoBehaviour
public int moveNum;
private ComputeBuffer inputbuffer;
private RenderData[] dataArray;
public RenderData[] dataArray;
private List<int> selectedGridIndex = new List<int>();
public List<int> selectedGridIndex = new List<int>();
private int shiftBeginIndex;
private List<Vector2> lassoPos = new List<Vector2>();
@@ -456,10 +456,11 @@ public class GridSelector : MonoBehaviour
for (int i = 0; i < dataArray.Length; i++)
{
CellType cell = (CellType)dataArray[i].barrier;
if (!cell.HasFlag(UICellEditor.Instance.editorGrid))
if (cell.HasFlag(CellType.Move))
{
dataArray[i].barrier |= (int)UICellEditor.Instance.editorGrid;
dataArray[i].barrier &= ~(int)CellType.Move;
}
dataArray[i].barrier |= (int)CellType.Obstacle;
}
RefreshPlaneRender();
}
@@ -468,10 +469,11 @@ public class GridSelector : MonoBehaviour
for (int i = 0; i < dataArray.Length; i++)
{
CellType cell = (CellType)dataArray[i].barrier;
if (cell.HasFlag(UICellEditor.Instance.editorGrid))
if (cell.HasFlag(CellType.Obstacle))
{
dataArray[i].barrier &= ~(int)UICellEditor.Instance.editorGrid;
dataArray[i].barrier &= ~(int)CellType.Obstacle;
}
dataArray[i].barrier |= (int)CellType.Move;
}
RefreshPlaneRender();
}
@@ -490,7 +492,7 @@ public class GridSelector : MonoBehaviour
inputbuffer.SetData(dataArray);
mapRenderer.material.SetBuffer("_InputData", inputbuffer);
}
private void GetXyByIndex(int index,out int x,out int y)
public void GetXyByIndex(int index,out int x,out int y)
{
x = index % horizontalNumber;
y = index / horizontalNumber;