Tuesday, June 14, 2011

Unity3D game development

Lab: Unity Project 1 - Point and Click



My solution here.

Another course I've found particularly useful: unity3d student.

I would like to obtain access to next chapters of Walker Boys Studio tutorial. In fact they did it really smart to require passing grades in order to continue. I did my homework here is my conclusion :)

Your Name: Michal Stefanow

Timeframe: 1 day to listen (6h), 1 day to build (6h), couple of hours to polish (2h)

Project Detail: Basically it was easy. The trickiest part was to apply timing events. Some showing off code for future reference.

In function that is fired when object is due to be removed I set variable that is checked in onGUI function. This is because some limitations in Update() and GUI features. I'm sure there is more rigid way of doing this but for me it works fine!


function explosionCircle() {
respawning = true;

addFlashingElement();
for (GUIcounter=0; GUIcounter<3; GUIcounter++) {// by setting GUIcounter we fire onGUI (condition)
yield WaitForSeconds(1);
}
removeFlashingElement();

if (explosion) { //to ensure expolosion exist
Instantiate (explosion, transform.position, transform.rotation);
}
if (audio.clip) {
audio.Play();
}

renderer.enabled = false;
RandomColor();
var position = Vector3(Random.Range(-8,8), Random.Range(-3.3,5.3), 0);
yield WaitForSeconds((respawnWaitTime+Random.Range(0,5))%4);
transform.position = position;
renderer.enabled = true;
numberOfClicks = storeClicks;
respawning = false;
}

var GUIcounter : int = -1; //we are not starting yet
function OnGUI () {
if (GUIcounter >= 0 && GUIcounter < 3) {
var viewPos : Vector3 = myCamera.WorldToScreenPoint(transform.position);
GUI.Label(Rect(viewPos.x, Screen.height-viewPos.y-40 ,100,100), "" + (3-GUIcounter));
} else if (GUIcounter > 3) {
GUIcounter = -1; //reseting back to -1
}

}


(sorry for that awful formatting, I need to find some gentle syntax highlighter or switch to wordpress)

I would also like to know how to setup light better?

I'm using "halo" to have more noticeable sign of existing light, I don't know why isn't visible on a spheres... Probably some materials issue yet to be solved.

Software Used: Unity3D only, cyberduck to upload, Chrome as a browser

Final Thoughts: This is powerful framework and I am really glad I can play with it. Thanks guys for great tutorial!

0 komentarze:

Post a Comment