Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void EvaluateSector(SectorTerrain sector, int fishCount)
- {
- //Debug.Log("EvaluateSector: (" + sector.x + ")(" + sector.z + ") NumFishes: " + fishCount);
- int placedFishes = 0;
- for (int i = 0; i < fishCount; i++)
- {
- float xMin = sector.x * sector.SectorBound;
- float xMax = sector.x * sector.SectorBound + sector.SectorBound;
- float zMin = sector.z * sector.SectorBound;
- float zMax = sector.z * sector.SectorBound + sector.SectorBound;
- Vector3 spawnPosition = new Vector3(Random.Range(xMin, xMax), fishHighPosition, Random.Range(zMin, zMax));
- RaycastHit hit;
- if (Physics.Raycast(spawnPosition, -Vector3.up, out hit, 1000.0f, 1 << LayerMask.NameToLayer("Terrain")))
- {
- if (hit.point.y + waterPlane.transform.position.y <= 3.0f)
- {
- ActivateFishObj(sector, spawnPosition, Quaternion.identity);
- placedFishes++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement