예제 #1
0
파일: Stage.cs 프로젝트: elsnehador/Crust
    public void generateNewStage(GameObject floorTile,
		                         GameObject wallBlock,
	                             GameObject coin,
	                             GameObject player,
	                             GameObject targetSprite,
	                             GameObject door,
		                         int difficulty,
	                             int maxDifficulty)
    {
        // Grab prefabs from function call
        _floorTile = floorTile;
        _wallBlock = wallBlock;
        _coin = coin;
        _player = player;
        _targetSprite = Instantiate(targetSprite);
        _door = door;
        // Determine size and num coins for this stage
        determineParamsBasedOnDifficulty(difficulty, maxDifficulty);
        // Create our maze
        _maze = new Maze(_size, difficulty, maxDifficulty);
        _maze.generateMap();
        // Allocate our arrays
        _coins = new GameObject[_numCoins];
        _components = new GameObject[(int)_size.x,(int)_size.y];
        // Instantiate our prefabs
        placeComponentsFromMap();
    }