void ActorSet::load(const PropertyBag &objects, World *_world) { ASSERT(_world!=0, "world was null"); world = _world; for(size_t i=0, n=objects.getNumInstances("object"); i<n; ++i) { const tuple<OBJECT_ID, ActorPtr> t = create(); const ActorPtr object = t.get<1>(); const PropertyBag decl = objects.getBag("object", i); const FileName templateFile = decl.getFileName("template"); const vec3 initialPosition = decl.getVec3("position"); const PropertyBag templateData = PropertyBag::fromFile(templateFile); const PropertyBag base = templateData.getBag("components"); ComponentDataSet s = ComponentDataSet::load(base, decl); // get actor name object->actorName = "(no name)"; templateData.get("name", object->actorName); object->load(s, initialPosition, vec3(0,0,0), world); object->setParentBlackBoard(this); } }
void ComponentGate::load(const PropertyBag &data) { resetMembers(); state = ("a" == toLowerCase(data.getString("initialState"))) ? STATE_A : STATE_B; positionA = data.getVec3("positionA"); positionB = data.getVec3("positionB"); timeToTransitionAB = data.getFloat("timeToTransitionAB"); timeToTransitionBA = data.getFloat("timeToTransitionBA"); }