Fox attacks gravestone

My fox after jumping the gravestone attacks it, I understand because in the fox script it says basically attack if it a defender, I thought about removing defender script off the gravestone but that would take the starcost and I would have to mess with a lot of code to make that work with out using the defender script. What am I missing that could make it work without rewriting some code.

Thanks,
Christopher

Never mind, I just put one line of code and now does what I want it to do.

        if (!otherObject.GetComponent<Gravestone>())
        {
            if (otherObject.GetComponent<Defender>())
            {
                GetComponent<Attacker>().Attack(otherObject);
            }
        }

Thanks,
Christopher

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms