Making a game where you play as a character made of fire. I want to make it so when the player jumps into the torch, the torch lights and the fire animation appears and plays. Here is what I have coded so far, I just can’t figure out how to only start playing the animation once torchIsLit = true
public class lightTorch : MonoBehaviour {
private bool torchIsLit = false;
Animator anim;
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
if (torchIsLit) {
Debug.Log ("Torch Lit");
}
}
void OnTriggerEnter2D(Collider2D other) {
torchIsLit = true;
}
}