summaryrefslogtreecommitdiff
path: root/scripts/map/Map.cs
blob: 683ae45764e983fb4f1643db0d5ed353b8d9c5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using Godot;
using System;

public partial class Map : Node2D
{
	public MapData Map_Data { get; private set; }

	DungeonGenerator generator;

	private void PlaceTiles() {
		foreach (Tile tile in Map_Data.Tiles) {
			AddChild(tile);
		}
	}

	public void Generate(Player player)
	{
		generator = GetNode<DungeonGenerator>("Generator");

		Map_Data = generator.GenerateDungeon(player);

		Map_Data.InsertActor(player);

		player.Map_Data = Map_Data;

		PlaceTiles();
	}
}