I'm creating a script that is generating a hexagonal map. I have a script that generates the base map and then a script on the same game object that will generate a river. I have been able to feed one parameter from the base map script to the river script and have it print a debug command but not two. When I try to feed both parameters I get this error Assets\Map_Builder.cs(42,46): error CS7036: There is no argument given that corresponds to the required formal parameter 'zmapmax' of 'River_Generator.makeRivers(int, int)'
Here is the code below:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Map_Builder : MonoBehaviour
{
public GameObject grasstile;
public int xmapmax=10;
public int zmapmax=10;
// Start is called before the first frame update
void Start()
{
for (float x=0; x().makeRivers(xmapmax, zmapmax);
}
}
and the second river generating script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class River_Generator : MonoBehaviour
{
public GameObject waterTile;
public int riverLength=10;
public void makeRivers(int xmapmax, int zmapmax){
//have the generator pick an outside edge tile using xmapmax and zmapmax
//the generator then replaces that tile with a water tile
//next the generator picks, at random, one of three directions that is opposite from the edge the river tile is on and replaces the tile in that direction
//the generator continues to pick one of three directions that are opposite from the previous tile and replace
//until it either reaches the river limit or a board edge.
print("" +Random.Range(0, xmapmax));
print("" +Random.Range(0, zmapmax));
print("make a river");
}
}
I assume it is something with how I fed the parameters in the Map_Builder script at the bottom but I can't quite see what I did wrong. Any help would be appreciated!
↧