Game Development Reference
In-Depth Information
rocket.constantForce.relativeForce.magnitude;
for (var rigid : Rigidbody in rigids) {
rigid.AddForce(rocketForce,ForceMode.VelocityChange);
}
GameObject.Destroy(gameObject);
onEnemyDie.Invoke();
}
}
}
}
// C# user:
protected override void UpdateHitPoint (Collision
collision) {
if (IS_GAMEOVER == false) {
if (collision.transform.tag == "Rocket") {
HitPoint.CURRENT_AI_INDEX = index;
Rocket rocket =
collision.gameObject.GetComponent<Rocket>();
HP = Mathf.Clamp(HP-rocket.damage, 0, _maxHP);
if (HP == 0) {
GameObject myRagdoll =
(GameObject)Instantiate(ragdoll,transform.position,transform.rotation);
Rigidbody[] rigids =
myRagdoll.GetComponentsInChildren<Rigidbody>();
Vector3 rocketForce =
rocket.transform.forward *
rocket.constantForce.relativeForce.magnitude;
foreach (Rigidbody rigid in rigids) {
rigid.AddForce(rocketForce,ForceMode.VelocityChange);
}
GameObject.Destroy(transform.parent.gameObject);
onEnemyDie();
}
Search WWH ::




Custom Search