public void GenerateWaterTiles() { var mpObj = GameObject.Find("MapManager"); mpGenertaor = mpObj.GetComponent <MPGenertaor>(); DeepWaterTile = DeepWaterPrefab.GetComponent <MapTile>(); int x = -1; int z = 1; for (z = 1; z >= -1; z--) { for (x = -1; x <= 1; x++) { MapTile ExistingTile = mpGenertaor.GetTileAt(DeepWaterTile.Column + x, DeepWaterTile.Row + z); if (ExistingTile == null) { GameObject newWaterTile = Instantiate(WaterPrefab); newWaterTile.transform.position = new Vector3(DeepWaterPrefab.transform.position.x + x, 0, DeepWaterPrefab.transform.position.z + z); MapTile newTile = newWaterTile.GetComponent <MapTile>(); newTile.Column = DeepWaterTile.Column + x; newTile.Row = DeepWaterTile.Row + z; mpGenertaor.UpdateTileList(newTile); } } } }
// Start is called before the first frame update void Start() { ResourceObject = GameObject.FindGameObjectWithTag("Resource"); var mapObj = GameObject.Find("MapManager"); mpGenertaor = mapObj.GetComponent <MPGenertaor>(); }
// Start is called before the first frame update void Start() // TotalPointsPerTurn += MovementPoints; { TotalPointsPerTurn = MovementPoints; // Getting Reference To Map Generator in Able to Use Helper Functions var mapObj = GameObject.Find("MapManager"); mpGenertaor = mapObj.GetComponent <MPGenertaor>(); hasAttacked = false; }
public void GenerateLittleRocks(MapTile tile) { var mpObj = GameObject.Find("MapManager"); mpGenertaor = mpObj.GetComponent <MPGenertaor>(); //----------- Needs To Be Condensed Down To Loops -----------// MapTile ExistingTile = mpGenertaor.GetTileAt(tile.Column - 1, tile.Row); if (ExistingTile == null) { GameObject newLittleRockTile = Instantiate(LittleRockPrefab); newLittleRockTile.transform.position = new Vector3(tile.transform.position.x - 1, 0, tile.transform.position.z); MapTile newTile = newLittleRockTile.GetComponent <MapTile>(); newTile.Column = tile.Column - 1; newTile.Row = tile.Row; mpGenertaor.UpdateTileList(newTile); } ExistingTile = mpGenertaor.GetTileAt(tile.Column, tile.Row + 1); if (ExistingTile == null) { GameObject newLittleRockTile = Instantiate(LittleRockPrefab); newLittleRockTile.transform.position = new Vector3(tile.transform.position.x, 0, tile.transform.position.z + 1); MapTile newTile = newLittleRockTile.GetComponent <MapTile>(); newTile.Column = tile.Column; newTile.Row = tile.Row + 1; mpGenertaor.UpdateTileList(newTile); } ExistingTile = mpGenertaor.GetTileAt(tile.Column + 1, tile.Row); if (ExistingTile == null) { GameObject newLittleRockTile = Instantiate(LittleRockPrefab); newLittleRockTile.transform.position = new Vector3(tile.transform.position.x + 1, 0, tile.transform.position.z); MapTile newTile = newLittleRockTile.GetComponent <MapTile>(); newTile.Column = tile.Column + 1; newTile.Row = tile.Row; mpGenertaor.UpdateTileList(newTile); } ExistingTile = mpGenertaor.GetTileAt(tile.Column, tile.Row - 1); if (ExistingTile == null) { GameObject newLittleRockTile = Instantiate(LittleRockPrefab); newLittleRockTile.transform.position = new Vector3(tile.transform.position.x, 0, tile.transform.position.z - 1); MapTile newTile = newLittleRockTile.GetComponent <MapTile>(); newTile.Column = tile.Column; newTile.Row = tile.Row - 1; mpGenertaor.UpdateTileList(newTile); } }