How can I activate a character's behavior WHEN another character is ON a gameobject?

Hi!

I’m wondering how to do this: (I looked for, but I don’t even know how to look for this!)

I have several Characters. When my Game starts, on of them moves from its position to a targetposition (he stands on a carpet); that’s done!.. What I need to do, is that the next Character that is going to go to the same targetposition, doesn’t move at all until the first character is not ON a gameobject (the same carpet).

I’m doing this because I want to create just 1 script (C# Please) to use it in all my characters. They are going to have the same behavior (move from its position to the same TargetPosition).

Thanks in advance!

Is this something where the order of action is fixed? If so, you might be able to get by with something roughly analogous to a “linked list” of characters, in which each characters needs to know only a few things:

  • A starting position
  • A goal position
  • Which character to activate once they’ve reached the goal position

There are a variety of ways to handle that last bit. If the order in which your characters move will never change, you could simply expose those values to the inspector and assign them from the editor. If you have something more dynamic in mind, you’ll need to (at some point) define an order, get references to each object in that order, and activate each object in turn.