added route
This commit is contained in:
@@ -150,8 +150,8 @@ namespace RH_Engine
|
|||||||
|
|
||||||
public string RouteCommand()
|
public string RouteCommand()
|
||||||
{
|
{
|
||||||
ImprovedPerlin improvedPerlin = new ImprovedPerlin(0, LibNoise.NoiseQuality.Best);
|
ImprovedPerlin improvedPerlin = new ImprovedPerlin(4325, LibNoise.NoiseQuality.Best);
|
||||||
|
Random r = new Random();
|
||||||
dynamic payload = new
|
dynamic payload = new
|
||||||
{
|
{
|
||||||
id = "route/add",
|
id = "route/add",
|
||||||
@@ -161,45 +161,50 @@ namespace RH_Engine
|
|||||||
{
|
{
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
pos = GetPos(0, improvedPerlin),
|
/*pos = GetPos(0.6f, improvedPerlin)*/
|
||||||
dir = GetDir()
|
pos = new int[] {0,0,5 },
|
||||||
|
dir = new int[] { r.Next(20,100),0,-r.Next(20, 100) }
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
pos = GetPos(1, improvedPerlin),
|
//pos = GetPos(1.6f, improvedPerlin),
|
||||||
dir = GetDir()
|
pos = new int[] {50,0,0 },
|
||||||
|
dir = new int[] { r.Next(20, 100),0,r.Next(20, 100) }
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
pos = GetPos(2, improvedPerlin),
|
//pos = GetPos(2.654f, improvedPerlin),
|
||||||
dir = GetDir()
|
pos = new int[] {20,0,20 },
|
||||||
|
dir = new int[] { r.Next(20, 100),0,r.Next(20, 100) }
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
pos = GetPos(3, improvedPerlin),
|
//pos = GetPos(3.6543f, improvedPerlin),
|
||||||
dir = GetDir()
|
pos = new int[] {10,0,50 },
|
||||||
|
dir = new int[] { -r.Next(3,7),0,r.Next(3,7) }
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
pos = GetPos(4, improvedPerlin),
|
pos = new int[] {0,0,50 },
|
||||||
dir = GetDir()
|
dir = new int[] { -r.Next(20, 50),0,-r.Next(20, 50) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(Payload(payload)));
|
Console.WriteLine("route command: " + JsonConvert.SerializeObject(Payload(payload)));
|
||||||
return JsonConvert.SerializeObject(Payload(payload));
|
return JsonConvert.SerializeObject(Payload(payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] GetPos(int n, ImprovedPerlin improvedPerlin)
|
private float[] GetPos(float n, ImprovedPerlin improvedPerlin)
|
||||||
{
|
{
|
||||||
return new int[] { (int)improvedPerlin.GetValue(n) * 50 * n, 0, (int)improvedPerlin.GetValue(n) * 50 };
|
float[] res = new float[] { improvedPerlin.GetValue(n) * 50, 0, improvedPerlin.GetValue(n) * 50 };
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] GetDir()
|
private int[] GetDir()
|
||||||
{
|
{
|
||||||
Random rng = new Random();
|
Random rng = new Random();
|
||||||
int[] dir = {rng.Next(5), rng.Next(5), rng.Next(5)};
|
int[] dir = {rng.Next(50), 0, rng.Next(50)};
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,31 +107,31 @@ namespace RH_Engine
|
|||||||
Console.WriteLine(ReadPrefMessage(stream));
|
Console.WriteLine(ReadPrefMessage(stream));
|
||||||
|
|
||||||
|
|
||||||
|
WriteTextMessage(stream, createGraphics.RouteCommand());
|
||||||
|
//string groundId = GetId("GroundPlane", stream, createGraphics);
|
||||||
|
//Console.WriteLine("ground id: " + groundId);
|
||||||
|
|
||||||
string groundId = GetId("GroundPlane", stream, createGraphics);
|
//WriteTextMessage(stream, createGraphics.SkyboxCommand(DateTime.Now.Millisecond % 24));
|
||||||
Console.WriteLine("ground id: " + groundId);
|
|
||||||
|
|
||||||
WriteTextMessage(stream, createGraphics.SkyboxCommand(DateTime.Now.Millisecond % 24));
|
//Console.WriteLine(ReadPrefMessage(stream));
|
||||||
|
|
||||||
Console.WriteLine(ReadPrefMessage(stream));
|
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("tunnelID is: " + tunnelID);
|
//Console.WriteLine("tunnelID is: " + tunnelID);
|
||||||
|
|
||||||
float[] heights = new float[65536];
|
//float[] heights = new float[65536];
|
||||||
Random random = new Random();
|
//Random random = new Random();
|
||||||
for (int i = 0; i < heights.Length; i++)
|
//for (int i = 0; i < heights.Length; i++)
|
||||||
{
|
//{
|
||||||
heights[i] = (float)random.NextDouble();
|
// heights[i] = (float)random.NextDouble();
|
||||||
}
|
//}
|
||||||
|
|
||||||
WriteTextMessage(stream, createGraphics.TerrainCommand(new int[] { 256, 256 }, heights));
|
//WriteTextMessage(stream, createGraphics.TerrainCommand(new int[] { 256, 256 }, heights));
|
||||||
Console.WriteLine(ReadPrefMessage(stream));
|
//Console.WriteLine(ReadPrefMessage(stream));
|
||||||
|
|
||||||
WriteTextMessage(stream, createGraphics.AddNodeCommand());
|
//WriteTextMessage(stream, createGraphics.AddNodeCommand());
|
||||||
Console.WriteLine(ReadPrefMessage(stream));
|
//Console.WriteLine(ReadPrefMessage(stream));
|
||||||
|
|
||||||
WriteTextMessage(stream, createGraphics.AddBikeModel());
|
//WriteTextMessage(stream, createGraphics.AddBikeModel());
|
||||||
|
|
||||||
//Console.WriteLine(ReadPrefMessage(stream));
|
//Console.WriteLine(ReadPrefMessage(stream));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user