Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
using LibNoise.Primitive;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace RH_Engine
|
||||
{
|
||||
@@ -185,7 +187,62 @@ namespace RH_Engine
|
||||
|
||||
public string RouteCommand()
|
||||
{
|
||||
return "";
|
||||
ImprovedPerlin improvedPerlin = new ImprovedPerlin(4325, LibNoise.NoiseQuality.Best);
|
||||
Random r = new Random();
|
||||
dynamic payload = new
|
||||
{
|
||||
id = "route/add",
|
||||
data = new
|
||||
{
|
||||
nodes = new dynamic[]
|
||||
{
|
||||
new
|
||||
{
|
||||
/*pos = GetPos(0.6f, improvedPerlin)*/
|
||||
pos = new int[] {0,0,5 },
|
||||
dir = new int[] { r.Next(20,100),0,-r.Next(20, 100) }
|
||||
},
|
||||
new
|
||||
{
|
||||
//pos = GetPos(1.6f, improvedPerlin),
|
||||
pos = new int[] {50,0,0 },
|
||||
dir = new int[] { r.Next(20, 100),0,r.Next(20, 100) }
|
||||
},
|
||||
new
|
||||
{
|
||||
//pos = GetPos(2.654f, improvedPerlin),
|
||||
pos = new int[] {20,0,20 },
|
||||
dir = new int[] { r.Next(20, 100),0,r.Next(20, 100) }
|
||||
},
|
||||
new
|
||||
{
|
||||
//pos = GetPos(3.6543f, improvedPerlin),
|
||||
pos = new int[] {10,0,50 },
|
||||
dir = new int[] { -r.Next(3,7),0,r.Next(3,7) }
|
||||
},
|
||||
new
|
||||
{
|
||||
pos = new int[] {0,0,50 },
|
||||
dir = new int[] { -r.Next(20, 50),0,-r.Next(20, 50) }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Console.WriteLine("route command: " + JsonConvert.SerializeObject(Payload(payload)));
|
||||
return JsonConvert.SerializeObject(Payload(payload));
|
||||
}
|
||||
|
||||
private float[] GetPos(float n, ImprovedPerlin improvedPerlin)
|
||||
{
|
||||
float[] res = new float[] { improvedPerlin.GetValue(n) * 50, 0, improvedPerlin.GetValue(n) * 50 };
|
||||
return res;
|
||||
}
|
||||
|
||||
private int[] GetDir()
|
||||
{
|
||||
Random rng = new Random();
|
||||
int[] dir = {rng.Next(50), 0, rng.Next(50)};
|
||||
return dir;
|
||||
}
|
||||
|
||||
public string FollowRouteCommand()
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace RH_Engine
|
||||
internal class Program
|
||||
{
|
||||
private static PC[] PCs = {
|
||||
//new PC("DESKTOP-TV73FK0", "woute"),
|
||||
//new PC("DESKTOP-M2CIH87", "Fabian"),
|
||||
new PC("T470S", "Shinichi"),
|
||||
//new PC("DESKTOP-DHS478C", "semme"),
|
||||
new PC("NA", "Ralf"),
|
||||
//new PC("T470S", "Shinichi"),
|
||||
new PC("DESKTOP-DHS478C", "semme"),
|
||||
//new PC("DESKTOP-TV73FKO", "Wouter"),
|
||||
new PC("DESKTOP-SINMKT1", "Ralf"),
|
||||
new PC("NA", "Bart") };
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
@@ -107,31 +107,31 @@ namespace RH_Engine
|
||||
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);
|
||||
Console.WriteLine("ground id: " + groundId);
|
||||
//WriteTextMessage(stream, createGraphics.SkyboxCommand(DateTime.Now.Millisecond % 24));
|
||||
|
||||
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];
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < heights.Length; i++)
|
||||
{
|
||||
heights[i] = (float)random.NextDouble();
|
||||
}
|
||||
//float[] heights = new float[65536];
|
||||
//Random random = new Random();
|
||||
//for (int i = 0; i < heights.Length; i++)
|
||||
//{
|
||||
// heights[i] = (float)random.NextDouble();
|
||||
//}
|
||||
|
||||
WriteTextMessage(stream, createGraphics.TerrainCommand(new int[] { 256, 256 }, heights));
|
||||
Console.WriteLine(ReadPrefMessage(stream));
|
||||
//WriteTextMessage(stream, createGraphics.TerrainCommand(new int[] { 256, 256 }, heights));
|
||||
//Console.WriteLine(ReadPrefMessage(stream));
|
||||
|
||||
WriteTextMessage(stream, createGraphics.AddNodeCommand());
|
||||
Console.WriteLine(ReadPrefMessage(stream));
|
||||
//WriteTextMessage(stream, createGraphics.AddNodeCommand());
|
||||
//Console.WriteLine(ReadPrefMessage(stream));
|
||||
|
||||
WriteTextMessage(stream, createGraphics.AddBikeModel());
|
||||
//WriteTextMessage(stream, createGraphics.AddBikeModel());
|
||||
|
||||
//Console.WriteLine(ReadPrefMessage(stream));
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LibNoise" Version="0.2.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user