public override void boardSetup() {
		
		boardHolder = new GameObject ("Board").transform;
		
		// Generate a map from Cellular Automata.
		// CellularAutomata foo = new CellularAutomata(rows, columns);
		//PureRandom foo = new PureRandom(rows, columns);
		GameObject playerChar = GameObject.FindGameObjectWithTag("Player");
		selectedRule.initializeMap ();
		selectedRule.generateMap ();
		Tile[,] mapConvert = selectedRule.map;

		MapValidationFunctions mvf = new MapValidationFunctions();

		Coord startPoint = new Coord(floodStartX,floodStartY); 
		Coord endPoint = new Coord(floodGoalX, floodGoalY);
		
		mvf.FloodFillCheck(selectedRule.map, startPoint, endPoint);

		// This is the autotiler phase.
		//
		// Let's try this method of instantiating the prefab of our choice...
		GameObject tileInstance = Instantiate(tilesetToUse, new Vector3(0,0,0), Quaternion.identity) as GameObject;
		
		selectedTileset = tileInstance.GetComponent<Tileset>();
		selectedTileset.autoTiler( mapConvert ); 

		if(MapValidationFunctions.clearable) Debug.Log ("The goal has been found!");
		else Debug.Log ("I can't find the goal.");
		
		//convertTiles( mapConvert );
		
	}
	public void pickWarpLocation() {
		// GOOD LOC OK
		int counter = 0;
		MapValidationFunctions mvf = new MapValidationFunctions();
		GameObject playerChar = GameObject.FindGameObjectWithTag ("Player");
		Vector3 startloc = new Vector3 (7, 30, 0);
		Rigidbody2D rb2D = playerChar.GetComponent<Rigidbody2D>() as Rigidbody2D;
		rb2D.MovePosition(startloc);

		return;
	}
	public CellularAutomata(int r, int c) {
		row = r;
		col = c;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
	public CellularAutomata() {
		row = 8;
		col = 8;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 5
0
	public DrunkardWalk() {
		row = 8;
		col = 8;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 6
0
	public void pickWarpLocation(Coord playerLocation) {
		// GOOD LOC OK
		int counter = 0;
		MapValidationFunctions mvf = new MapValidationFunctions();
		GameObject playerChar = GameObject.FindGameObjectWithTag ("Player");
		bool mercyLength = false;
		int playerX = playerLocation.x;
		int playerY = playerLocation.y;
		int candidX = 0;
		int candidY = 0;
		while(true && counter < 200){

			if(counter > 100 && !mercyLength) {
				Debug.Log ("Lasted too long, give a mercy kill for the distance metric.");
				mercyLength = true;
			}

			do {
				candidX = Random.Range(1, rows-1);
				candidY = Random.Range(1, columns-1);
			} while (candidX == playerX && candidY == playerY);

			Tile[,] candidMap = selectedRule.map;
			MapValidationFunctions.clearMapMark(candidMap);
			Debug.Log ("Proposing point " + candidX.ToString () + " and " + candidY.ToString());
			mvf.FloodFillCheck( candidMap, new Coord(candidX, candidY), new Coord(playerX, playerY));
			if((candidMap[candidX,candidY]).property == TileType.Floor1
			   && MapValidationFunctions.clearable
			   && ( MapValidationFunctions.manhattanDistance( new Coord(candidX, candidY), new Coord(playerX, playerY) ) >= (int)(rows)
			        || MapValidationFunctions.manhattanDistance( new Coord(candidX, candidY), new Coord(playerX, playerY) ) >= (int)(columns)
			   		|| mercyLength)) {
				// We need to move the player to this position.
				Vector3 moveMe = new Vector3(candidX, candidY);
				GameObject warpObj = GameObject.FindGameObjectWithTag("Warp");
				warpObj.transform.position = moveMe;
				Debug.Log ("Found. Warp is at (" + candidX + "," + candidY + ")");
				return;
			}
			Debug.Log ("Failed for " + playerX.ToString () + " and " + playerY.ToString () + " to " + candidX.ToString () + " and " + candidY.ToString());
			counter++;
		}

		// You really don't want to be at this spot.
		Debug.Log ("I give up. Default warp to the midpoint.");
		Vector3 findme = new Vector3(rows/2,columns/2);
		GameObject ok = GameObject.FindGameObjectWithTag("Warp");
		ok.transform.position = findme;
		return;
	}
Ejemplo n.º 7
0
	public MoistLucifer(int r, int c) {
		row = 16;
		col = 16;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 8
0
	public MoistLucifer() {
		row = 8;
		col = 8;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 9
0
	public SemiRandom(int r, int c) {
		row = r;
		col = c;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 10
0
	public SemiRandom() {
		row = 8;
		col = 8;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 11
0
	public BossStage() {
		row = 8;
		col = 8;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 12
0
	public BossStage(int r, int c) {
		row = 16;
		col = 32;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 13
0
	public Nazareth(int r, int c) {
		row = 16;
		col = 16;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}
Ejemplo n.º 14
0
	public Nazareth() {
		row = 8;
		col = 8;
		map = new Tile[row,col];
		mapValidFuncs = new MapValidationFunctions();
	}