Game Development Reference
In-Depth Information
We are done with creaing the Rockslide game object, which will look something similar to
the following screenshot:
We now need to create the new script to control the Rockslide . Go to Assets | Create |
Javascript , name it Rocks , and replace the code as follows:
public var downForce : float = 10;
private var a_rigid : Rigidbody[]; //Array of the children's Rigidbody
private var b_isTrigger : boolean = false; // Is this object is
already triggered (Use for Trigger object)
private var in_count : int = 0; //Counting the number of Kinematic
Rock
//Setup Index of Children before start
public function Awake () : void {
b_isTrigger = false;
a_childRock = new Array();
int_childLength = 0;
in_count = 0;
//Get all children's rigidbody
a_rigid = gameObject.GetComponentsInChildren.<Rigidbody>();
}
// Use this for initialization
public function Start () : void {
//Disable rigidbody before it triggered or hit by rocket
DisabledRigidBody();
}
 
Search WWH ::




Custom Search