fixed compass and jumping
This commit is contained in:
@@ -45,21 +45,26 @@ public class Tile : MonoBehaviour
|
||||
int iterations = 0;
|
||||
Vector3 newPoint;
|
||||
bool canSpawn;
|
||||
while(list.Count < objectAmount){
|
||||
while (list.Count < objectAmount)
|
||||
{
|
||||
iterations++;
|
||||
canSpawn = true;
|
||||
newPoint = new Vector3(rand.Next(-40, 40) + 100 * position.x, 50, rand.Next(-40, 40) + 100 * position.z);
|
||||
foreach(Vector3 vector in list){
|
||||
if(Vector3.Distance(vector, newPoint) < 10){
|
||||
foreach (Vector3 vector in list)
|
||||
{
|
||||
if (Vector3.Distance(vector, newPoint) < 10)
|
||||
{
|
||||
canSpawn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(canSpawn && !list.Contains(newPoint)){
|
||||
if (canSpawn && !list.Contains(newPoint))
|
||||
{
|
||||
list.Add(newPoint);
|
||||
iterations = 0;
|
||||
}
|
||||
if(iterations >= 1000){
|
||||
if (iterations >= 1000)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user