Hello, this is probably redundancy overload but I'm such a noob that'll ask you to bear with me....
What I have is this:
private var beenHit:boolean = false;
private var timer:float = 0.0;
static var targetHit = 0;
var targetRoot:GameObject;
var NPC:GameObject;
var hitSound:AudioClip;
var resetSound:AudioClip;
function OnCollisionEnter(theObject:Collision) {
print("Animate Object Hit1");
if(beenHit == false && theObject.GameObject.name == "Kenny") {
targetRoot.animation.Play("animate");
beenHit = true;
}
}
function Update () {
if(beenHit) {
timer += Time.deltaTime;
}
if(timer > 3) {
print("Target Timer");
targetRoot.animation.Play("idle");
beenHit = false;
timer = 0.0;
}
}
And what I would like is to, rather than detecting "Kenny" it will detect the var NPC. This may be super simple but I'm not seeing it so... help?
Thanks!
DaveA
2
theObject.GameObject.name == NPC.name