Saturday, 9 March 2013

Prefabs and Player Controls

Okay so I have some kind of path generating and I've ironed out some obvious bugs I can see from the scene viewer in Unity, but now it's time to get inside the dungeon and test it from the inside as if I were playing the game. For this to happen I'm going to get some outside help. I need rooms to load instead of these primitive Unity cubes as well as a Player Character to run through these rooms with.

Rooms -

I'm lucky enough to have some housemates with skills in different areas, two of them being product design. One of these housemates (lets call him Darksteel) agreed to make me some place holder rooms for my dungeon. I needed some hollowed out cubes with doors on each side in several combinations.

4 Doors
3 Doors
2 Doors (Parallel)
2 Doors (Adjacent)
1 Door

Darksteel promptly made me these rooms and I modified my script to load in his 4 door rooms as prefabs, added some lights and this is what I got :

Unfortunately I haven't edited my script to detect which room to load in but I think that deserves it's own blog post as it's going to be somewhat complex.

Player Character -

I'm also very lucky to be teamed up with some other skilled programmers who are working on other parts of the game unrelated to dungeon generation. This meant we already had a Player Character prefab set up, this meant I could just reuse the assets they had created. I  then set up my script to load in the Player Character prefab into the First Room using the same if statement I made to draw it. Other than that some changes I made were the scale of the Player Character and adding Terrain and Mesh collision to my prefabs.

It is now possible to traverse my dungeon from the inside as if you were playing the game :)

Here is a pic from the Player Character's camera :

No comments:

Post a Comment