Game Development Reference
In-Depth Information
//rotate so y axis is pointing outward from contact point
this.transform.rotation = rot;
this.transform.localScale.x*=
collision.relativeVelocity.
magnitude/5.0;
this.transform.localScale.y*= 0.2;
this.transform.localScale.z*=
collision.relativeVelocity.
magnitude/5.0;
timeSet = Time.fixedTime + countdown;
explosionActivated = true;
}
}
function Explode()
{
var exp : GameObject = Instantiate(explosion, explosion
Location,
explosionDirection);
exp.GetComponent("Detonator").detail = detailLevel;
Destroy(exp, explosionLife);
}
function Update ()
{
if(Time.fixedTime > = timeSet && explosionActivated)
{
//set off explosion
Explode();
explosionActivated = false;
//remove the explosive device from
game environment
Destroy(this.gameObject);
}
}
Step 4. Click on the bullet prefab in the Project. Find the
Explosion property of the blob script and set it to Detonator-
Insanity. You can find this by clicking on the little circle next
to the property field or drag and drop this prefab from the
Project. It can be found in Standard Assets > Detonator > Prefab
Examples.
Step 5. Save and play. Drop a sticky bullet somewhere and stand
back and watch.
Search Nedrilad ::




Custom Search