Unity: Test Build 01
My first exported game!! (Well I suppose “game” is probably more appropriate) You can try it out here – note: the first time you run it, it will prompt you to download the web player for Unity, but it’s a one-time thing
It was pretty easy to start – the 3D scene viewer makes adding objects and understanding the game world a breeze.
I started out with adding a 1st person controller to a flat plane. From there, I added 4 walls, a big tree, and textures (all from the Standard Assets library). I made a prefab for the dastardly cube enemies, and made them spawnable with a right click. Here is the code for actual spawn:
var instanceEnemy = Instantiate(prefabEnemy, Vector3(0,0,0), transform.rotation);
Instantiate creates an object, named prefabEnemy, at location x=0, y=0, z=0, and uses the standard rotation (which I think is direction that it faces).
The flashlight mechanic is in this build as well (middle-click) to toggle on/off. The “flashlight” itself is just a directional light source parented to the main camera, while the toggle is simply light.enabled = !light.enabled;
The other lights in the scene are point lights with varying levels of range and color. When playing around with different colors, I liked the nighttime-feel of the blue, so I left it in
In testing out the reset mechanic, I used a sphere as the test object, so when you walk into the sphere, the level starts over from scratch.
The next few things to add are a score system, hide the mouse cursor, and a make a varying spawn system, so the enemy cubes don’t all spawn in the same spot. Though I will say it is a lot of fun to frantically right click, then line them all up and mow them down, literally like ducks in a row