Book Image

Unity 3 Game Development HOTSHOT

By : Jate Wittayabundit
Book Image

Unity 3 Game Development HOTSHOT

By: Jate Wittayabundit

Overview of this book

<p>Unity 3d is the game engine of choice for creating professional looking games at no cost. Its combination of powerful tools and outstanding community support make it the natural choice for experienced and aspiring game developers. <br /><br />Unity3D Game Development Hotshot will show you how to exploit the full array of Unity3Dtechnology in order to create an advanced gaming experience for the user. It has eight exciting and challenging projects with step- by-step explanations, diagrams, screenshots, and downloadable materials.<br /><br />Every project is designed to push your Unity skills to the very limits and beyond. You will create a hero/heroine for a role playing game. Create a menu for the RPG game allowing you to customize your character with powerups, armor, and weapons. You will shade, model, rig, and animate your hero/heroine. The end result will be a&nbsp; character on the level of Final Fantasy, far superior to a simple sprite.<br /><br />Now for some damage - rocket launchers! Typically the most powerful weapons in any first person shooter, you will create a rocket launcher that has fire and smoke particles and most importantly causes splash damage for that all important area effect. Create AI controlled enemies for your hero/heroine to eliminate with the rocket launcher. Forge&nbsp; a destructible&nbsp; interactive world so if the rocket launchers miss their target they will at least cause significant damage to the surrounding environment. Learn to save and load your game so you can take a break from the action for life’s necessities like going to the bathroom. Incorporate social gaming by uploading scores online so everyone can see the carnage.</p>
Table of Contents (19 chapters)
Unity 3 Game Development HOTSHT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Function/method definitions


First of all, terminology—JavaScript uses the term function, while C# calls these methods. They mean the same thing, and most C# coders understand the term function.

JavaScript functions are declared with the keyword function before the function name. C# method declarations just use the return type, and the method name. The return type is often void for common Unity events. JavaScript functions are public by default, and you can specify them as private if required. C# methods are private by default, and you can specify that they should be public if required.

In JavaScript, you can omit the parameter types and the return type from the declaration, but it's also possible to explicitly specify these (which is sometimes necessary if you run into ype ambiguity problems).

JavaScript:

// a common Unity Monobehaviour event handler: 
function Start () { ...function body here... }  

// a private function: 
private function TakeDamage (amount) { 
energy -= amount; 
}  

// a public function with a return type. 
// the parameter type is "Transform", and the return type is "int" 

function GetHitPoint (hp : int) : int {
   return (maxHp—hp); 
}

C#:

// a common Unity monobehaviour event handler: 
void Start() { ...function body here... }  

// a private function: 
void TakeDamage(int amount) {     
energy -= amount; 
}  

// a public function with a return type. 
// the parameter type is "Transform", and the return type is "int" 

public int GetHitPoint (int hp) {     
  return (maxHp—hp); 
}