override public void MutateChunk(Age.TerrainChunk chunk, ChunkParameters parms) { if (parms.addMode == Age.TerrainChunk.AddMode.Max) { float maxHeight = .12f + (.80f * this.quantity * parms.targetHeight); chunk.Clamp(this.quantity * -parms.targetHeight, maxHeight); } else { chunk.Clamp(this.quantity * -parms.targetHeight, this.quantity * parms.targetHeight); } }
override public void MutateChunk(Age.TerrainChunk chunk, ChunkParameters parms) { chunk.Roughen(this.quantity); }
override public void MutateParameters(ChunkParameters parms) { parms.targetRadius = this.quantity; }
private static void ApplyPhrase(Age.TerrainChunk map, Phrase phrase) { // Let param changing adjectives have their turn ChunkParameters parms = new ChunkParameters(); parms.targetRadius = 0.5f; parms.targetHeight = 0.5f; parms.world = map; // Default location int x = map.GetWidth() / 2; int y = map.GetHeight() / 2; foreach (Adjective adjective in phrase.adjectives) { adjective.MutateParameters(parms); } Age.TerrainPoint[] points = new Age.TerrainPoint[]{new Age.TerrainPoint(x, y)}; if (phrase.location != null) { points = phrase.location.GetPoints(parms); } foreach (Age.TerrainPoint point in points) { Age.TerrainChunk chunk = phrase.feature.GetChunk(parms); foreach (Adjective adjective in phrase.adjectives) { if (adjective.adverbDelegate == null) { adjective.MutateChunk(chunk, parms); } else { adjective.adverbDelegate.MutateChunk(chunk, parms); } } int px = point.x - chunk.GetWidth() / 2; int py = point.y - chunk.GetHeight() / 2; map.AddChunk(chunk, px, py, parms.addMode); } }
virtual public void MutateParameters(ChunkParameters parms){}
virtual public void MutateChunk(Age.TerrainChunk chunk, ChunkParameters parms){}
override public Age.TerrainChunk GetChunk(ChunkParameters parameters) { int radius = (int)(MAP_SIZE * parameters.targetRadius * .5f); parameters.addMode = Age.TerrainChunk.AddMode.Add; Age.TerrainChunk chunk = Age.TerrainChunk.MakeMountainChunk(radius, parameters.targetHeight * .5f); chunk.Roughen(0.2f, 5.0f); return chunk; }
override public Age.TerrainChunk GetChunk(ChunkParameters parameters) { int radius = (int)(MAP_SIZE * parameters.targetRadius * 0.25); parameters.addMode = Age.TerrainChunk.AddMode.Add; Age.TerrainChunk output = Age.TerrainChunk.MakeMountainChunk(radius, -parameters.targetHeight); return output; }
public abstract Age.TerrainChunk GetChunk(ChunkParameters parameters);
override public Age.TerrainChunk GetChunk(ChunkParameters parameters) { int radius = (int)(MAP_SIZE * parameters.targetRadius); Age.TerrainChunk chunk = Age.TerrainChunk.MakeMountainChunk(radius, Mathf.Max(parameters.targetHeight, 7.0f / 25.0f)); chunk.Roughen(0.5f, 1.5f); //chunk.Min(7.0f / 25.0f); chunk.Min((6.0f / 25.0f) + ((7.0f / 25.0f) * parameters.targetHeight)); chunk.Roughen(0.02f, 20.0f); return chunk; }
override public Age.TerrainPoint[] GetPoints(ChunkParameters parms) { int center_x = parms.world.GetWidth() / 2; int center_y = parms.world.GetHeight() / 2; int x = center_x + (int)(this.x * this.quantity * parms.world.GetWidth() / 2); int y = center_y + (int)(this.y * this.quantity * parms.world.GetWidth() / 2); return new Age.TerrainPoint[]{new Age.TerrainPoint(x, y)}; }
override public Age.TerrainPoint[] GetPoints(ChunkParameters parms) { int max = (int)(this.quantity * 25); Age.TerrainPoint[] output = new Age.TerrainPoint[max]; for (int n = 0; n < max; n++) { float x = (parms.world.GetWidth() / 2) + (Random.value - 0.5f) * (parms.world.GetWidth() * this.quantity / 2); float y = (parms.world.GetHeight() / 2) + (Random.value - 0.5f) * (parms.world.GetHeight() * this.quantity / 2); output[n] = new Age.TerrainPoint((int)(x), (int)(y)); } return output; }
virtual public Age.TerrainPoint[] GetPoints(ChunkParameters parms) { return new Age.TerrainPoint[0]; }
override public void MutateChunk(Age.TerrainChunk chunk, ChunkParameters parms) { Age.TerrainChunk dupe = chunk.Clone(); this.adjective.MutateChunk(dupe, parms); chunk.HeightBlend(dupe); }
override public void MutateChunk(Age.TerrainChunk chunk, ChunkParameters parms) { chunk.FillTexture(Age.STONE, this.quantity); }