Esempio n. 1
0
	public int[,] CreateMapFromGraph(Graph grph)
	{
		allNodes = grph.ReturnAllNodes(); 

		Room room = new Room (0, new Coord(0,0), 3, 3);

		while (agents.Count > 0) {
			agents [0].Activate ();		
			agents.RemoveAt (0);
		}

		int[,] mapOfPoints = MapToGrid (map);
		for (int l = 0; l < connections.Count; l = l +2) 
		{
			Room room1 = rooms[0];
			Room room2 = rooms[0];

			bool room1Set = false; 
			bool room2Set = false; 
			foreach (Room ro in rooms) {
				if (ro.roomID == connections [l]) {
					room1 = ro; 
					room1Set = true; 
				}else if (ro.roomID == connections [l+1]) {
					room2 = ro; 
					room2Set = true; 
				}
			}
			if (room1Set && room2Set) {
				mapOfPoints = ConnectPoints (mapOfPoints, room1.currentPosition.x, room1.currentPosition.y, room2.currentPosition.x, room2.currentPosition.y);
			}
		}

		return mapOfPoints; 
	}