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


C++ MetaObject::setPosition方法代码示例

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


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

示例1: main

int main(void){
	partime = new parTime();	// setup the timing info for the simulation
	partime->setTimeOffset(8,30,30); // hours, minutes, seconds from midnight
	partime->setTimeRate(1);		 // how fast should time change

	// Create an Actionary
	actionary=new Actionary();
	actionary->init();

	MetaObject* object = new MetaObject("Sink_0"); // Creates a single Sink object

	// Give the object a position of 8,1,2
	Vector<3> *pos=new Vector<3>();
	pos->v[0]=8.0f;
	pos->v[1]=1.0f;
	pos->v[2]=2.0f;
	object->setPosition(pos);

	// Check to see what actions are associated with a sink
	std::cout << "The sink can be cleaned (true or false)? " << object->searchAffordance(actionary->searchByNameAct("Clean"),0) << std::endl;
	std::cout << "The sink can be eaten (true or false)? " << object->searchAffordance(actionary->searchByNameAct("Eat"),0) << std::endl;

	//Allows the object to clean
	std::cout << "The sink can be cleaned (true or false)? " << object->searchAffordance(actionary->searchByNameAct("Clean"),1) << std::endl;
	actionary->addAffordance(actionary->searchByNameAct("Clean"),object,1);
	std::cout << "The sink can be cleaned (true or false)? " << object->searchAffordance(actionary->searchByNameAct("Clean"),1) << std::endl;

	//Creates a new object, and adds the sink to it's contents
	MetaObject* container= new MetaObject("Bookshelf_large");
	container->addContents(object);

	//Checks to see if the object is in the contents of the container (physcially) and the possession (mentally)
	std::cout<<"The sink is physically in the bookshelf(true or false)? "<<container->searchContents("Sink_0")<<std::endl;
	std::cout<<"The sink is owned by the bookshelf(true or false)? "<<container->searchPossession("Sink_0")<<std::endl;

	system("PAUSE");
}
开发者ID:GAIA-GMU,项目名称:PAR,代码行数:37,代码来源:main.cpp


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