36 lines
863 B
C#
36 lines
863 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class WorldGenerator : MonoBehaviour
|
|
{
|
|
public List<GameObject> availableTiles;
|
|
Dictionary<Vector3, GameObject> world;
|
|
int SIZE = 10;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
world = new Dictionary<Vector3, GameObject>();
|
|
generateWorld();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
void generateWorld(){
|
|
Vector3 position;
|
|
GameObject tile;
|
|
for(int i = 0; i < SIZE; i++){
|
|
for(int j = 0; j < SIZE; j++){
|
|
position = new Vector3(i, 0, j);
|
|
tile = Instantiate(availableTiles[0], position * 100, Quaternion.identity);
|
|
world.Add(position, tile);
|
|
}
|
|
}
|
|
}
|
|
}
|