当前位置: 首页>>代码示例>>C++>>正文


C++ Tile::SetFeature方法代码示例

本文整理汇总了C++中Tile::SetFeature方法的典型用法代码示例。如果您正苦于以下问题:C++ Tile::SetFeature方法的具体用法?C++ Tile::SetFeature怎么用?C++ Tile::SetFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tile的用法示例。


在下文中一共展示了Tile::SetFeature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadFromXML

//---------------------------------------------------------------------------------------------------------------------------
//LOADING
//---------------------------------------------------------------------------------------------------------------------------
void Feature::LoadFromXML(const XMLNode& node) {

	std::vector<XMLUtils::Attribute> featureAttribs;
	XMLUtils::GetAllAttributesOfNode(node, featureAttribs);

	for (unsigned int i = 0; i < featureAttribs.size(); i++) {
		XMLUtils::Attribute& currAttrib = featureAttribs[i];
		String currAttribName = currAttrib.name;
		String currAttribVal = currAttrib.value;

		if (currAttribName == "name") {
			m_name = currAttribVal;
		}
		else if (currAttribName == "position") {
			m_position = XMLUtils::ParseIntVector2FromXML(currAttribVal);
		}
		else if (currAttribName == "glyphActivated") {
			m_glyphActivated = XMLUtils::ParseCharFromXML(currAttribVal);
		}
		else if (currAttribName == "glyphDeactivated") {
			m_glyphDeactivated = XMLUtils::ParseCharFromXML(currAttribVal);
		}
		else if (currAttribName == "colorActivated") {
			m_colorActivated = XMLUtils::ParseFloatColorFromXML(currAttribVal);
		}
		else if (currAttribName == "colorDeactivated") {
			m_colorDeactivated = XMLUtils::ParseFloatColorFromXML(currAttribVal);
		}
		else if (currAttribName == "featureType") {
			m_featureType = (eFeatureType)XMLUtils::ParseIntFromXML(currAttribVal);
		}
		else if (currAttribName == "featureState") {
			m_featureState = (eFeatureState)XMLUtils::ParseIntFromXML(currAttribVal);
		}
		else if (currAttribName == "activeBlocksLOS") {
			m_activeBlocksLOS = XMLUtils::ParseIntFromXML(currAttribVal) != 0;
		}
		else if (currAttribName == "deactiveBlocksLOS") {
			m_deactiveBlocksLOS = XMLUtils::ParseIntFromXML(currAttribVal) != 0;
		}
		else if (currAttribName == "activeBlocksPathing") {
			m_activeBlocksPathing = XMLUtils::ParseIntFromXML(currAttribVal) != 0;
		}
		else if (currAttribName == "deactiveBlocksPathing") {
			m_deactiveBlocksPathing = XMLUtils::ParseIntFromXML(currAttribVal) != 0;
		}
	}

	m_id = s_entityIDs++;
	m_backgroundColor = RGBA(0.5f, 0.5f, 0.5f, 1.f);

	Tile* tileToPlaceOn = g_theWorld->m_activeMap->GetTileAtLocation(m_position);
	tileToPlaceOn->SetFeature(this);
	g_theWorld->m_entitiesOnMap.push_back(this);
}
开发者ID:ntaylorbishop,项目名称:Paradise,代码行数:58,代码来源:Feature.cpp


注:本文中的Tile::SetFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。