Hello, I want my player to draw a weapon, which i managed. But there’s a problem with my booleans when i’m trying to make him draw back his weapon. It’s seems the boolean doesn’t want to switch. The console is not telling anything, there be somethin wrong with logic ^^. Here’s the script
var sword : GameObject;
var weaponOut : boolean = true;
function Update () {
if (Input.GetKeyDown(KeyCode.L)){
Draw();
}
}
function Draw() {
if (!weaponOut) {
animation.Play("drawSword");
weaponOut = true;
yield WaitForSeconds(0.4);
sword.active = true;
}
if (weaponOut) {
animation.Play("drawBackSword");
weaponOut = false;
yield WaitForSeconds(0.4);
sword.active = false;
}
}