示例#1
0
void Fruit::Load(tinyxml2::XMLElement const& element)
{
    char const* sprite = element.Attribute("Sprite");
    assert(sprite);
    m_Sprite.Load(sprite);
    m_Sprite.SetOriginToCentre();

    m_Score = element.IntAttribute("Score");
    m_Appear1 = element.IntAttribute("Appear1");
    m_Appear2 = element.IntAttribute("Appear2");
    m_Time = element.FloatAttribute("Time");
}
示例#2
0
void Restaurant::decodeXML(tinyxml2::XMLElement & xml)
{
	Item::decodeXML(xml);
	variant = xml.IntAttribute("variant");
	open    = xml.BoolAttribute("open");
	updateSprite();
}
示例#3
0
void Elevator::decodeXML(tinyxml2::XMLElement & xml)
{
	clearCars();
	Item::decodeXML(xml);
	size.y = xml.IntAttribute("height");
	for (tinyxml2::XMLElement * e = xml.FirstChildElement("unserviced"); e; e = e->NextSiblingElement("unserviced")) {
		unservicedFloors.insert(e->IntAttribute("floor"));
	}
	for (tinyxml2::XMLElement * e = xml.FirstChildElement("car"); e; e = e->NextSiblingElement("car")) {
		Car * car = new Car(this);
		car->decodeXML(*e);
		cars.insert(car);
	}
	updateSprite();
}