예제 #1
0
파일: Program.cs 프로젝트: bennuttle/Maize
        static void Main(string[] args)
        {
            MazeGraph testGraph = new MazeGraph(3, 3, 3);
            testGraph.BreadthFirstSearch(testGraph[0, 0, 0]);

            Console.ReadLine();
        }
예제 #2
0
	public void createMaze(int difficulty) {
		MazeGraph testthis = new MazeGraph (difficulty);	
		MazeNode [, ,] temp = testthis.getAllNodes();
		MazeNode mazeGoal = testthis.goal;
		for (int x = 0; x < testthis.sizeX; x++)
		{
			for (int y = 0; y < testthis.sizeY; y++)
			{
				for (int z = 0; z < testthis.sizeZ; z++)
				{
					//					MazeNode[,,] temp = testthis.graph[x,y,z];
					if(temp[x,y,z].y_minus == null) {
						Instantiate(floor,new Vector3 (x*10, y*10, z*10), floor.transform.rotation);
						//						floor.transform.position = new Vector3 (x*10, y*10, z*10);
					} else { /*print("floor : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].y_plus == null) {
						Instantiate(ceiling,new Vector3 (x*10,y*10 + 10, z*10),ceiling.transform.rotation);
						//ceiling.transform.position = new Vector3 (x*10,y*10 + 10, z*10);
					} else { /*print("ceiling : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].z_plus == null) {
						Instantiate(front, new Vector3 (x*10, y*10 + 5,z*10 +  5), front.transform.rotation);
						//						front.transform.position = new Vector3 (x*10, y*10 + 5,z*10 +  5);
					} else { /*print("front : x="+x+", y="+y+", z="+z);*/} 
					if(temp[x,y,z].z_minus == null) {
						Instantiate(back,new Vector3 (x*10, y*10 + 5,z*10 - 5),back.transform.rotation);
						//						back.transform.position = new Vector3 (x*10, y*10 + 5,z*10 - 5);
					} else { /*print("back : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].x_plus == null) {
						Instantiate(right, new Vector3 (x*10 + 5,y*10 + 5, z*10), right.transform.rotation);
						//						right.transform.position = new Vector3 (x*10 + 5,y*10 + 5, z*10);
					} else { /*print("right : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].x_minus == null) {
						Instantiate(left, new Vector3 (x*10 - 5,y*10 + 5, z*10), left.transform.rotation);
						//						left.transform.position = new Vector3 (x*10 - 5,y*10 + 5, z*10);
					} else { /*print("left : x="+x+", y="+y+", z="+z);*/}
				}
			}
		}
		Instantiate (EndBox, new Vector3 ((mazeGoal.x_loc) * 10, (mazeGoal.y_loc) * 10 + 5, (mazeGoal.z_loc) * 10), EndBox.transform.rotation);
		Instantiate (characterRef);
	}
예제 #3
0
	void Start () {
		MazeGraph testthis = new MazeGraph (size,size,size);	
		MazeNode [, ,] temp = testthis.getAllNodes();
		for (int x = 0; x < size; x++)
		{
			for (int y = 0; y < size; y++)
			{
				for (int z = 0; z < size; z++)
				{
					//					MazeNode[,,] temp = testthis.graph[x,y,z];
					if(temp[x,y,z].y_minus == null) {
						Instantiate(floor,new Vector3 (x*10, y*10, z*10), floor.transform.rotation);
						//						floor.transform.position = new Vector3 (x*10, y*10, z*10);
					} else { /*print("floor : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].y_plus == null) {
						Instantiate(ceiling,new Vector3 (x*10,y*10 + 10, z*10),ceiling.transform.rotation);
						//ceiling.transform.position = new Vector3 (x*10,y*10 + 10, z*10);
					} else { /*print("ceiling : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].z_plus == null) {
						Instantiate(front, new Vector3 (x*10, y*10 + 5,z*10 +  5), front.transform.rotation);
						//						front.transform.position = new Vector3 (x*10, y*10 + 5,z*10 +  5);
					} else { /*print("front : x="+x+", y="+y+", z="+z);*/} 
					if(temp[x,y,z].z_minus == null) {
						Instantiate(back,new Vector3 (x*10, y*10 + 5,z*10 - 5),back.transform.rotation);
						//						back.transform.position = new Vector3 (x*10, y*10 + 5,z*10 - 5);
					} else { /*print("back : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].x_plus == null) {
						Instantiate(right, new Vector3 (x*10 + 5,y*10 + 5, z*10), right.transform.rotation);
						//						right.transform.position = new Vector3 (x*10 + 5,y*10 + 5, z*10);
					} else { /*print("right : x="+x+", y="+y+", z="+z);*/}
					if(temp[x,y,z].x_minus == null) {
						Instantiate(left, new Vector3 (x*10 - 5,y*10 + 5, z*10), left.transform.rotation);
						//						left.transform.position = new Vector3 (x*10 - 5,y*10 + 5, z*10);
					} else { /*print("left : x="+x+", y="+y+", z="+z);*/}
				}
			}
		}
		Instantiate (EndBox, new Vector3 ((size - 1) * 10, (size - 1) * 10 + 5, (size - 1) * 10), EndBox.transform.rotation);
	}
예제 #4
0
파일: Player.cs 프로젝트: bennuttle/Maize
			public CurrentMaze(MazeGraph theMaze)
			{
				currentStepsTaken = 0;
				currentOptimalPathLength = theMaze.getOptimalSolutionLength();
				currentDifficulty = theMaze.sizeX + theMaze.sizeY + theMaze.sizeZ;
				currentMazeTime = 0;
			}
예제 #5
0
파일: Player.cs 프로젝트: bennuttle/Maize
		public void startMaze(MazeGraph theMaze)
		{
			myMaze = new CurrentMaze(theMaze);
		}