Hello, I am making a sword game, and I have an enemy that I want to kill the player. I have a working AI script, but when I tried to make an attack script, I failed. I want it so when you collide with it 2 or 3 times, it loads to a new level. Here is my current code:
#pragma strict
var timesToTakeToKill : float = int;
var target = Transform;
function OnColliderEnter(collision : Collision) {
Die();
}
function Die()
{
if(collision("Player", => timesToTakeToKill));
{
Application.LoadLevel("MainMenu");
}
}
Please help! I am a beginner to Unity3D!
↧