So basically i have some scenery that when the player hits it it deals damage. but what i want to do is if the player stays on for say 5 seconds it ends in death.
here is what i got:
var Crammus : GameObject;
var crammusScript;
var collisionTime : float = 0;
function Awake () {
crammusScript = Crammus.GetComponent("CrammusFlying");
}
function OnCollisionEnter(collision : Collision) {
crammusScript.SceneryDamage();
}
function OnCollisionStay(collisionInfo : Collision)
{
collisionTime = Time.deltaTime;
if ( collisionTime > 5)
{
Application.LoadLevel("Level1");
}
}
no the only thing i don’t know how to do is time while there is a collision. I figure my collisionTime = Time.deltaTime; should probably be in an Update function but i can’t put OnCollisionStay as an if, any ideas?
Thanks