I have a script named Enemy.cs with the function:
killedByPlayer()
There are two enemies ——A and B both with Enemy.cs.
-
When A is killed and executes
killedByPlayer(),I want B to excute
killedByPlayer() as well. -
Vice versa, when B executes
killedByPlayer(), I want A to excute
killedByPlayer().
How could I reach it? Simply call the other one in killedByPlayer() will end up with an infinite loop.
Thanks!!!