📅  最后修改于: 2022-03-11 14:48:57.028000             🧑  作者: Mango
var pixels = myTexture.GetPixels32();
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = Color.black;
}
// Draw ants
foreach (Ant ant in ants)
{
for (int i = 0; i < cellSize; i++)
{
for (int j = 0; j < cellSize; j++)
{
// TODO: calculate the index of the pixel in the flat array
// Not 100% sure on that one tbh ;)
var index = (ant.thisX * cellSize + i) + myTexture.width * (ant.thisY * cellSize + j);
pixels[index] = Color.white
}
}
}
myTexture.SetPixels32(pixels);
myTexture.Apply();