Contents

struct

SushiEngine::Simulation::ScriptField

One named, typed field of a script component instance.

Declared in
engine/world/simulation/include/SushiEngine/simulation/entity_types.hpp
void on_message(SushiEngine::Simulation::IWorldEditor& world,
                SushiEngine::Simulation::EntityId self,
                SushiEngine::Simulation::EntityId sender,
                const std::string& name,
                const SushiEngine::Simulation::ScriptField& payload) override
{
    if (name == "StartSpinning")
    {
        SushiEngine::Simulation::ScriptField speed;
        speed.name = "speed";
        speed.kind = SushiEngine::Simulation::ScriptFieldKind::Float;
        speed.number = payload.number;

        SushiEngine::Simulation::ScriptComponent script;
        script.type_name = "SpinningLight";
        script.fields.push_back(speed);
        world.add_script_component(self, script);
    }
    if (name == "StopSpinning")
        world.remove_script_component(self, "SpinningLight");
}

Properties

name

Field name as authored.

kind
number

Float/Int payload.

flag

Bool payload.

vector

Vector3/Color payload.

text

Text payload.