void SetNewOrePatch(int leadX, int leadY, Rock.RockType rType) { // FIX THIS! Making density calculation totally random! int distance = ResourceGrid.Grid.pseudoRandom.Next(0, 21); int density = 0; if (distance >= 15) { // pick a 1 or 2 density int pick = Random.Range(0, 2); density = pick; } else if (distance < 15 && distance > 8) { // pick between 4 or 5 density int pick = Random.Range(2, 4); density = pick; } else { density = 5; } OrePatch patch = new OrePatch(leadX, leadY, density, rType); // Debug.Log("ORE PATCH at lead x " + leadX + " lead Y " + leadY); patch.SetFormation(); ResourceGrid.Grid.PlaceOrePatch(patch, rType); }
void SetNewOrePatch(int leadX, int leadY, string typeName) { // first make sure that there is NO WATER tiles around this lead tile if (!CheckForWater (leadX, leadY)) { Debug.Log ("Found tile with no water around it!"); // Calculate the distance from this lead tile to the center of the map, // the closer to the center the DENSER a patch of ore will be float distance = Vector2.Distance (new Vector2 (leadX, leadY), new Vector2 (centerPosX, centerPosY)); int density = 0; if (distance >= 20) { // pick a 1 or 2 density float pick = Random.Range (0, 3); density = (int)pick; } else if (distance < 14 && distance > 8) { // pick between 4 or 5 density float pick = Random.Range (3, 5); density = (int)pick; } else { density = 5; } OrePatch patch = new OrePatch (leadX, leadY, density); patch.SetFormation (); PlaceOrePatch(patch, typeName); } else { Debug.Log("Could not place ore patch because " + leadX + "," + leadY+ " is a shore!"); } }