コード例 #1
0
ファイル: GenerateMaze.cs プロジェクト: sarahrothberg/WWW
    private void DrawMaze()
    {
        wallPosArray = maze.GetWallArray();

        endWallPos   = maze.GetEndWallArray();
        startWallPos = maze.GetStartWallArray();


        if (MazeMode == MazeGeneratorMode.WithPrefabs)
        {
            for (int j = 0; j < wallPosArray.Count; j++)
            {
                if (UseStartEndWall)
                {
                    if (IsPosInArray(wallPosArray[j], endWallPos))
                    {
                        GameObject obj = (GameObject)Instantiate(EndWallPrefab, wallPosArray[j], Quaternion.identity);
                        obj.transform.parent = transform;
                        mazeWalls.Add(obj);
                    }
                    else if (IsPosInArray(wallPosArray[j], startWallPos))
                    {
                        GameObject obj = (GameObject)Instantiate(StartWallPrefab, wallPosArray[j], Quaternion.identity);
                        obj.transform.parent = transform;
                        mazeWalls.Add(obj);
                    }
                    else
                    {
                        GameObject obj = (GameObject)Instantiate(wallPrefab, wallPosArray[j], Quaternion.identity);
                        obj.transform.parent = transform;
                        mazeWalls.Add(obj);
                    }
                }
                else
                {
                    GameObject obj = (GameObject)Instantiate(wallPrefab, wallPosArray[j], Quaternion.identity);
                    obj.transform.parent = transform;
                    mazeWalls.Add(obj);
                }
            }
        }
        if (IsCreateGround)
        {
            groundObg = (GameObject)Instantiate(groundPrefab, maze.GetPosionForGround(), Quaternion.identity);
            groundObg.transform.localScale = new Vector3(maze.GetSizeForGround().x, 1, maze.GetSizeForGround().y);
            groundObg.transform.parent     = transform;
            mazeWalls.Add(groundObg);
        }

        if (IsCreateCeiling)
        {
            ceilingObj = (GameObject)Instantiate(ceilingPrefab, maze.GetPosionForCeiling(), Quaternion.identity);
            ceilingObj.transform.localScale = new Vector3(maze.GetSizeForGround().x, 1, maze.GetSizeForGround().y);
            ceilingObj.transform.parent     = transform;
            mazeWalls.Add(ceilingObj);
        }
    }