private mapSpace[,] generateMap() { mapSpace[,] newMap = new mapSpace[WORLD_WIDTH, WORLD_DEPTH]; for (int i = 0; i < WORLD_WIDTH; i++) { for (int J = 0; J < WORLD_DEPTH; J++) { newMap[i, J] = new mapSpace(mapSpace.Immovables.Space); newMap[i, J].youAreAt(worldPositionFor(i, J)); } } return(newMap); }
// Start is called before the first frame update void Start() { int currentLevel = 10; theMap = new mapSpace[WORLD_WIDTH, WORLD_DEPTH]; items = FindObjectOfType <ItemsControl>(); theMap[5, 5] = new mapSpace(mapSpace.Immovables.Wall); Instantiate(WallPrefab, new Vector3(5, 0, 5), Quaternion.identity); for (int i = 0; i < 10; i++) { generateRandomItem(currentLevel); } }
// Start is called before the first frame update void Start() { Wall = (GameObject)Resources.Load("WallPreFab"); int currentLevel = 10; theMap = generateMap(); items = FindObjectOfType <ItemsControl>(); monsterManager = FindObjectOfType <MonsterManager>(); theMap[5, 5] = new mapSpace(mapSpace.Immovables.Wall); for (int i = 0; i < 10; i++) { generateRandomItem(currentLevel); } Vector2Int newPosition = randomEmptyPosition(); // Creature newMonster = monsterManager.createMonsterAt(newPosition); // place(newMonster, newPosition); }