using UnityEngine; namespace Generators { public class IslandGenerator : IGenerator { private IGenerator noise; public float Inner { get; set; } = 20; public float Outer { get; set; } = 23; public float Threshold { get; set; } = .5f; public IslandGenerator(IGenerator noise) { this.noise = noise; } public double GetValue(Vector2 position) { var distance = position.magnitude / 10; distance = (distance - Inner) / (Outer - Inner); var result = noise.GetValue(position) + .75 * (Mathf.Clamp(0, distance, 1) - 1); return result > Threshold ? 1 : 0; } } }