I'm trying to open a simple wooden door when my FPS player walks close to the door using a raycast and a taged door, I=My door opens fine with a nice creaky door sound but I can't seem to get it to close after I'm through the door. I'm trying to use a tmer but I'm sure I'm mucking it up somewhere although I get no script error mesages so I'm at a bit of a loss as to where I'm buggering it up??
Here is my script I'm using:
enum bobsDoorStates {open, closed};
var bobsDoorState : bobsDoorStates;
var doorSound : AudioClip;
var doorSoundClose : AudioClip;
var timer : float = 0.0;
function Awake() {
bobsDoorState = bobsDoorStates.closed;
}
function Update () {
}
function Open() {
animation.Play("FBDoorOpen");
bobsDoorState = bobsDoorStates.open;
audio.PlayOneShot (doorSound);
}
if(timer >= 3){
Close();
}
function Close(){
animation.Play("FBDoorClose");
bobsDoorState = bobsDoorStates.closed;
timer = 0;
audio.PlayOneShot (doorSoundClose);
}