private GameApplication() { Terrain = new TerrainApplication(); ConnectionManager = new ConnectionManagerApplication(); SocketController = new SocketControllerApplication("127.0.0.1", 8080); //registra comunicação com o terreno foreach (var action in Terrain.SocketMessageTypes) { SocketController.RegisterMessageType(action); } var updateChunksProcess = new ApplicationThread(100); //update thread event updateChunksProcess.OnRun += (obj) => { string error; if (!Terrain.UpdateChunks(out error)) { Log(error); } }; updateThreads.Add(updateChunksProcess); var updateBlocksProcess = new ApplicationThread(100); //update thread event updateBlocksProcess.OnRun += (obj) => { string error; if (!Terrain.UpdateBlocks(out error)) { Log(error); } }; updateThreads.Add(updateBlocksProcess); var updateApplication = new ApplicationThread(100); //update thread event updateApplication.OnRun += (obj) => { string error; if (!Terrain.UpdateBlocks(out error)) { Log(error); } }; updateThreads.Add(updateApplication); }
public TerrainGenerator(TerrainApplication app) { MaxHeightOfHills = app.WorldMap.MaxSize.y; roughness = Mathf.Clamp(roughness, 0f, 100f) / 100f; noise2dRandomValues = new ProtoVector2[2]; noise3dRandomValues = new ProtoVector2[256]; noise1 = new PerlinNoise2D(1 / (5f * granularity), randomize, noise2dRandomValues[0]).SetOctaves(5); noise2 = new PerlinNoise2D(1 / (5f * granularity), randomize, noise2dRandomValues[1]).SetOctaves(2); noise3d = new PerlinNoise3D(1 / granularity, randomize, noise3dRandomValues); noise2dRandomValues[0] = noise1.Offset; noise2dRandomValues[1] = noise2.Offset; noise3dRandomValues = noise3d.RandVals; application = app; }
public GameApplication() { Terrain = new TerrainApplication(); SocketController = new SocketControllerApplication("127.0.0.1", 8080); foreach (var action in Terrain.SocketMessageTypes) { SocketController.RegisterMessageType(action); } var updateApplication = new ApplicationThread(100); //update thread event updateApplication.OnRun += (obj) => { string updateError; if (!Update(out updateError)) { Log(updateError); } }; updateThreads.Add(updateApplication); }