playMaker

Author Topic: Best way send event to multiple objects inside Collider  (Read 2690 times)

mweyna

  • Full Member
  • ***
  • Posts: 242
Best way send event to multiple objects inside Collider
« on: January 14, 2015, 04:28:59 AM »
What would be the best way to find all objects inside the Collider quickly? I want the behavior that upon a trigger fire, if enemy units are standing inside a space, everything in that space will receive an FSM event. With the current collider actions, I can apply it individually, but not across all objects.

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Best way send event to multiple objects inside Collider
« Reply #1 on: January 15, 2015, 12:32:47 PM »
Anyone?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Best way send event to multiple objects inside Collider
« Reply #2 on: January 15, 2015, 12:53:54 PM »
In 1.7.x this would probably be best handled with ArrayMaker.

Whatever method you use to do this sort of thing, you basically need an array. The flow is essentially 1) Find all of the relevant objects 2) Store them in an array/list 3) Get the item and do the thing you want [send event] 4) Get the next item in the list and repeat (3) until done with the array/list.

There is probably a comprehensive example of doing this or something very similar in the ArrayMaker example scenes.

In 1.8.x there is a native FsmArray variable and new Actions, so it will be much easier to store groups of objects and sort/iterate through them. ArrayMaker should work fine though.
« Last Edit: January 15, 2015, 12:56:22 PM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Best way send event to multiple objects inside Collider
« Reply #3 on: January 16, 2015, 02:13:01 AM »
I've done this in the past using ArrayMaker doing exactly that, just wanted to know if there was a quicker more effective way rather then going one by one. Since it's basically requiring multiple actions to send something.