During the challenge we were asked to get the gravestone to wobble when being attacked by a attacker. We also did not want the stone to wobble when a projectile went through it. I was able to get the gravestone to wobble when both a projectile and a attacker attacked the gravestone through this code here.
private Animator animator;
private Attacker attacker;
private Shooter projectile;
void Start(){
animator = GetComponent<Animator>();
attacker = GameObject.FindObjectOfType<Attacker>();
projectile = GameObject.FindObjectOfType<Shooter>();
}
private void OnTriggerStay2D(Collider2D collider){
if(attacker){
animator.SetTrigger("underAttack trigger");
}
}
}
Why would the projectile in this case cause my gravestone to move?