예제 #1
0
	void PhysicsNode::writeXml(Xml *xml) const {

		Node::writeXml(xml);

		Xml *transform = xml->addChild("init_transform");

		transform->setArg("pos", init_pos);
		if (init_rot.isIdentity() == false) transform->setArg("rot", init_rot);
		if (init_scale.isOne() == false) transform->setArg("scale", init_scale);

		if (body->getBody() != BODY_BOX) xml->setChildData("body", int(body->getBody()));
		if (body->getMass() != 0.0f) xml->setChildData("mass", body->getMass());
		if (!render_body) xml->setChildData("render_body", render_body);
		if (object_2d) xml->setChildData("object_2d", object_2d);

	}
예제 #2
0
	void TriggerNode::writeXml(Xml *xml) const {
		Node::writeXml(xml);

		xml->setChildData("group", group);
		if (intersectGroup) xml->setChildData("intersect_group", intersectGroup);

		Xml *parent = NULL;

		for (int i=0; i<TRIGGER_EVENT_COUNT; i++) {
			if (events[i].name == "") continue;
			if (parent == NULL) {
				parent = xml->addChild("events");
			}
			Xml *event = parent->addChild("event");
			event->setArg("type", getTriggerEventName(TriggerEventType(i)));
			event->setData(events[i].name);
		}

	}
예제 #3
0
	void ParticleSystemNode::writeXml(Xml *xml) const {

		Node::writeXml(xml);
		Xml *child = NULL;

		xml->setChildData("emitter", int(emitter));
		xml->setChildData("spawn_rate", spawnRate);

		// life_time
		child = xml->addChild("life_time");
		child->setData(lifeTime);
		child->setArg("dispersion", lifeTimeDispersion);

		// size
		child = xml->addChild("size");
		child->setData(size);
		child->setArg("dispersion", sizeDispersion);

		// growth
		child = xml->addChild("growth");
		child->setData(growth);
		child->setArg("dispersion", growthDispersion);

		// speed
		child = xml->addChild("speed");
		child->setData(speed);
		child->setArg("mag_dispersion", speedDispersion);
		child->setArg("dir_dispersion", directionDispersion);

		// src_color
		child = xml->addChild("src_color");
		child->setData(srcColor);
		child->setArg("dispersion", srcColorDispersion);

		// dst_color
		child = xml->addChild("dst_color");
		child->setData(dstColor);
		child->setArg("dispersion", dstColorDispersion);

		// gravity
		xml->setChildData("gravity", gravity);

	}