public IProcedural Generate() { GenerateCubeFaces(); Generated.Invoke(this, new EventArgs()); return(this); }
private void GenetateData() { var generatedData = _generator(); var json = JsonConvert.SerializeObject(generatedData); Logger.Info($"Generate object with type: [{generatedData.GetType()}], object: [{json}]"); Generated?.Invoke(generatedData); }
/// <summary> /// Perform generation of new BonusLife. /// </summary> protected virtual void Generate() { GeneratedLife = new BonusLife(TimeSpan.FromSeconds(10)); var pos = _coinsPositions[_random.Next(0, _coinsPositions.Count)]; GeneratedLife.X = pos.Item1; GeneratedLife.Y = pos.Item2; Generated?.Invoke(this, EventArgs.Empty); }
private void threadStart() { VectorGenerator vectorGenerator = new VectorGenerator(paths); while (!stop) { if (vectorGenerator.Step(TimeSpan.FromSeconds(0.1))) { VectorPath = vectorGenerator.Generate(VectorPower, VectorSpeed); GCodeProgram = GCodeGenerator.Generate(VectorPath, 1000.0, maxFeed); Generated?.Invoke(this, null); } } thread = null; }
public IProcedural Generate() { int i = 0; for (int x = 0; x < Bounds.X; x++) { int y = 0; int z = 0; //System.Diagnostics.Debug.WriteLine($"V:{x},{y},{z} | {VoxelSize}"); for (y = 0; y < Bounds.Y; y++) { for (z = 0; z < Bounds.Z; z++) { Vector3 coords = new Vector3(x, y, z) * VoxelSize; var n = NoiseModule2D.GetValue(x, z); Dictionary <ECubeFace, float> noisyNeighbors = new Dictionary <ECubeFace, float>(); noisyNeighbors.Add(ECubeFace.Top, NoiseModule.GetValue(x, y + 1, z)); noisyNeighbors.Add(ECubeFace.Bottom, NoiseModule.GetValue(x, y - 1, z)); noisyNeighbors.Add(ECubeFace.Left, NoiseModule.GetValue(x - 1, y, z)); noisyNeighbors.Add(ECubeFace.Right, NoiseModule.GetValue(x + 1, y, z)); noisyNeighbors.Add(ECubeFace.Front, NoiseModule.GetValue(x, y, z - 1)); noisyNeighbors.Add(ECubeFace.Back, NoiseModule.GetValue(x, y, z + 1)); IVoxel voxel = new Voxel { Id = Guid.NewGuid(), Bounds = VoxelSize, Coordinates = coords, Noise = n, NeighborNoiseValues = noisyNeighbors, Material = new Material(n) }; voxel.Generated += OnVoxelInitialized; Debug.WriteLine($"Voxel: {i}"); voxel.Generate(); } } } if (Voxels.Count == Bounds.X * Bounds.Y * Bounds.Z) { Generated.Invoke(this, new EventArgs()); } return(this); }
public void Start() { dsa.Execute(); Generated?.Invoke(); }