fixed chest, improved ui, improved difficulty
This commit is contained in:
@@ -36,16 +36,30 @@ public class Tile : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<Vector3> getSpawnLocations()
|
||||
{
|
||||
List<Vector3> list = new List<Vector3>();
|
||||
int objectAmount = rand.Next(20, 101);
|
||||
int objectAmount = objectAmount = rand.Next(40, 151);
|
||||
int iterations = 0;
|
||||
Vector3 newPoint;
|
||||
bool canSpawn;
|
||||
while(list.Count < objectAmount){
|
||||
iterations++;
|
||||
canSpawn = true;
|
||||
newPoint = new Vector3(rand.Next(-40, 40) + 100 * position.x, 50, rand.Next(-40, 40) + 100 * position.z);
|
||||
if (!list.Contains(newPoint))
|
||||
{
|
||||
foreach(Vector3 vector in list){
|
||||
if(Vector3.Distance(vector, newPoint) < 10){
|
||||
canSpawn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(canSpawn && !list.Contains(newPoint)){
|
||||
list.Add(newPoint);
|
||||
iterations = 0;
|
||||
}
|
||||
if(iterations >= 1000){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -60,19 +74,6 @@ public class Tile : MonoBehaviour
|
||||
GameObject content = contentGenerator.GetComponent<ContentGenerator>().generateContent(tiletype.ToString());
|
||||
if (content != null)
|
||||
{
|
||||
float verticeX = position.x / 10;
|
||||
float verticeZ = position.z / 10;
|
||||
|
||||
Vector3 vertice = new Vector3(Mathf.Round(verticeX), 0, Mathf.Round(verticeZ));
|
||||
Vector3[] vertices = gameObject.GetComponent<MeshFilter>().mesh.vertices;
|
||||
|
||||
foreach(Vector3 v in vertices){
|
||||
if(v.x == vertice.x && v.z == vertice.z){
|
||||
position.y = v.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GameObject obj = Instantiate(content, position, Quaternion.identity, gameObject.transform);
|
||||
if (obj.tag.Contains("Enemy"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user