I am trying to tweak the shooter.cs so it will not put the defender into the firing animation before the attacker shows up on the field. Doing some digging, it seems like renderer.isVisible is the way to go but it’s not working as i expected. Any help or guidance would be appreciated.
Here is the snippit in question:
> bool IsAttackerAheadInLane() {
> // Exit if no attackers in lane
> if (myLaneSpawners.transform.childCount <= 0) {
> return false;
> }
> // If there are attackers, are they ahead of the defender?
> foreach (Transform attacker in myLaneSpawners.transform) {
> //attacker = attacker.transform.position.x >= 10;
> if ((attacker.transform.position.x > transform.position.x) && attacker.renderer.isVisible) {
> return true;
> }
> }
> // Attacker in lane, but behind us
> return false;
> }
Thanks in advanced.