public void Generate(Vector3 Pos, float r) { Radius = r; Position = new Point(Pos.x, Pos.z); Depth = UnityEngine.Random.Range(1.0f, 2.0f); InitialKethaneAmount = UnityEngine.Random.Range(10000, MaximumAmount); Kethane = InitialKethaneAmount; InitialKuraniumAmount = UnityEngine.Random.Range(10000, MaximumAmount); Kuranium = InitialKuraniumAmount; Vertices = new List<Point>(); int VerticesCount = UnityEngine.Random.Range(20, 50); for (int i = 0; i < VerticesCount; i++) { float RandomRadius = UnityEngine.Random.Range(0.45f * r, r); float Angle = 2.0f * (float)Math.PI * ((float)i / (float)VerticesCount); float x = Pos.x + RandomRadius * (float)Math.Cos(Angle); float z = Pos.z - RandomRadius * (float)Math.Sin(Angle); Vertices.Add(new Point(x, z)); } Shape = new Polygon(Vertices.ToArray()); }
public static Deposit Generate(Vector2 Pos, float radius, System.Random random, ResourceDefinition resource) { var initialQuantity = random.Range(resource.MinQuantity, resource.MaxQuantity); var vertices = new List<Point>(); int vertexCount = random.Next(resource.MinVertices, resource.MaxVertices); for (int i = 0; i < vertexCount; i++) { float randomRadius = random.Range(resource.RadiusVariance * radius, radius); float angle = 2.0f * (float)Math.PI * ((float)i / (float)vertexCount); float x = Pos.x + randomRadius * (float)Math.Cos(angle); float z = Pos.y - randomRadius * (float)Math.Sin(angle); vertices.Add(new Point(x, z)); } var Shape = new Polygon(vertices.ToArray()); return new Deposit(Shape, initialQuantity, initialQuantity); }
public Deposit(Polygon shape, float quantity, float initialQuantity) { Shape = shape; Quantity = quantity; InitialQuantity = initialQuantity; }
public Deposit(Polygon shape, double quantity, double initialQuantity) { Shape = shape; Quantity = quantity; InitialQuantity = initialQuantity; }