Hello,
I am trying to make something working, but for reasons I do not know, it is not working. I have made a script to activate a particle flame when you’re inside the trigger zone of the flame. That works fine!
I want to activate an animation if all flames are on, but for some reason it does not work. My guess, it has to do with the &&. This is my script:
#pragma strict
var flame:Transform;
var flame1 = false;
var flame2 = false;
var flame3 = false;
var flame4 = false;
static var allFlame = 0;
//var flameStart = false;
var onFlame = false;
function Start ()
{
flame.active = false;
}
function Update ()
{
if(onFlame && Stefan_Player.gotTorch)
{
flame.active = true;
if(flame.name == "Flame1")
{
print("flame1 is on");
flame1 = true;
}
if(flame.name == "Flame2")
{
print("flame2 is on");
flame2 = true;
}
if(flame.name == "Flame3")
{
print("flame3 is on");
flame3 = true;
}
if(flame.name == "Flame4")
{
print("flame4 is on");
flame4 = true;
}
}
if(flame1 && flame2 && flame3 && flame4)
{
print("freaking BURRN!!");
}
}
function OnTriggerEnter( hit : Collider )
{
if(hit.gameObject.tag == "Player" )
{
onFlame = true;
}
}
function OnTriggerExit( hit : Collider )
{
if(hit.gameObject.tag == "Player" )
{
onFlame = false;
}
}