inset_pos in range refactor
This commit is contained in:
parent
9914948a50
commit
59c0d5ee4d
1 changed files with 6 additions and 20 deletions
26
src/Mono.cs
26
src/Mono.cs
|
@ -90,26 +90,12 @@ static class Mono
|
||||||
}
|
}
|
||||||
|
|
||||||
XYZi next_pos = snake[0] + snake_dir;
|
XYZi next_pos = snake[0] + snake_dir;
|
||||||
bool around_box = false;
|
XYZi inset_pos = new(
|
||||||
for (int i = 0; i < directions.Length; i++)
|
next_pos.x - Maths.sign(next_pos.x),
|
||||||
{
|
next_pos.y - Maths.sign(next_pos.y),
|
||||||
if (s_array.InRange(next_pos + directions[i]))
|
next_pos.z - Maths.sign(next_pos.z)
|
||||||
{
|
);
|
||||||
around_box = true;
|
bool around_box = s_array.InRange(inset_pos);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!around_box)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < corners.Length; i++)
|
|
||||||
{
|
|
||||||
if (s_array.InRange(next_pos + corners[i]))
|
|
||||||
{
|
|
||||||
around_box = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!around_box)
|
if (!around_box)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue