Skip to content
Snippets Groups Projects
Commit 4c040a32 authored by Clément's avatar Clément
Browse files

8 MARS

parent da0d7503
No related branches found
No related tags found
No related merge requests found
......@@ -80,28 +80,53 @@ public class genTerrainRoute : MonoBehaviour
return heights;
}
ArrayList drawChemin()
int[,] pointsChemin()
{
ArrayList x = new ArrayList();
ArrayList y = new ArrayList();
ArrayList points = new ArrayList();
int[,] points = new int [2, 5];
for (int i = 0; i < 6; i++)
{
if (i == 0)
{
x.Add(Random.Range(0, 10000));
y.Add(Random.Range(0, 10000));
points[0, i] = (Random.Range(0, 10000));
points[1, i] = (Random.Range(0, 10000));
}
else
{
x.Add(Random.Range((int) x[i]+1, 10000));
y.Add(Random.Range((int)y[i]+1, 10000));
points[0, i] = (Random.Range(points[0, i-1]+1, 10000));
points[1, i] = (Random.Range(points[1, i-1]+1, 10000));
}
}
points.Add(x);
points.Add(y);
return points;
}
void drawChemin()
{
int[,] points = pointsChemin();
int x0, y0, x1, y1, x, y, dx, dy, deltaE, deltaNE, d;
for (int i = 0; i < points.Length; i++)
{
x0 = points[0, i];
y0 = points[1, i];
x1 = points[0, i + 1];
y1 = points[1, i + 1];
dx = x1 - x0;
dy = y1 - y0;
deltaE = 2 * dy;
deltaNE = 2 * (dy - dx);
d = 2 * dy - dx;
}
}
}
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment