SushiEngine::Simulation::IWorldEditor
send_message
virtual void send_message(EntityId sender, EntityId target, const std::string &name, const ScriptField &payload={})=0Parameters
| Name | Type | Description |
|---|---|---|
sender | EntityId | Handed to each receiver as |
target | EntityId | An unknown entity, or one with no behaviors, makes the call a no-op. |
name | const std::string & | |
payload | const ScriptField & |
Description
Broadcasts a named message to every behavior on target.
See also
engine/world/simulation/include/EDITOR.md
Example
void on_update(SushiEngine::Simulation::IWorldEditor& world,
SushiEngine::Simulation::EntityId id,
const SushiEngine::Simulation::TickContext& context) override
{
elapsed_seconds_ += context.delta_seconds;
if (sent_ || elapsed_seconds_ < SushiEngine::Scalar(10))
return;
world.send_message(id, world.parent(id), "TurnOff", {});
sent_ = true;
}

