topical media & game development
lib-unity-tutorial-platform-start-Assets-Scripts-Player-FalloutDeath.js / js
function OnTriggerEnter (other : Collider)
{
// Player fall out!
if (other.GetComponent (ThirdPersonStatus))
{
other.GetComponent (ThirdPersonStatus).FalloutDeath();
}
// Kill all rigidibodies flying through this area
// (Props that fell off)
else if (other.attachedRigidbody)
Destroy(other.attachedRigidbody.gameObject);
// Also kill all character controller passing through
// (enemies)
else if (other.GetType() == typeof(CharacterController))
Destroy(other.gameObject);
}
// Auto setup the pickup
function Reset ()
{
if (collider == null)
gameObject.AddComponent(BoxCollider);
collider.isTrigger = true;
}
@script AddComponentMenu("Third Person Props/Fallout Death")
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.