本文整理汇总了C++中Tank::resetAll方法的典型用法代码示例。如果您正苦于以下问题:C++ Tank::resetAll方法的具体用法?C++ Tank::resetAll怎么用?C++ Tank::resetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tank
的用法示例。
在下文中一共展示了Tank::resetAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTank
Tank* TankManager::createTank(const Ogre::Vector3& position, int side, Graph* pathFindingGraph, PathFinding mPathFinder){
int tankNumber = tankSideA.size() + tankSideB.size();
std::ostringstream oss1;
oss1 << "tankbody" << tankNumber;
Ogre::Entity* tankBody = mSceneMgr->createEntity(oss1.str(), "lpbody.mesh");
tankBody->setCastShadows(true);
std::ostringstream oss2;
oss2 << "tankturret" << tankNumber;
// Create tank turret entity
Ogre::Entity* tankTurret = mSceneMgr->createEntity(oss2.str(), "lpturret.mesh");
tankTurret->setCastShadows(true);
std::ostringstream oss3;
oss3 << "tankbarrel" << tankNumber;
// Create tank barrel entity
Ogre::Entity* tankBarrel = mSceneMgr->createEntity(oss3.str(), "lpbarrel.mesh");
tankBarrel->setCastShadows(true);
// Create a child scene node and attach tank body to it
Ogre::SceneNode* mTankBodyNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
mTankBodyNode->attachObject(tankBody);
// Move it above the ground
mTankBodyNode->translate(position.x, position.y + 13.f, position.z);
if(side == 1){
tankBody->setMaterialName("lp_tank_materialred");
tankTurret->setMaterialName("lp_tank_materialred");
tankBarrel->setMaterialName("lp_tank_materialred");
mTankBodyNode->yaw(Ogre::Degree(180.f));
}
else if(side == 2)
{
tankBody->setMaterialName("lp_tank_materialblue");
tankTurret->setMaterialName("lp_tank_materialblue");
tankBarrel->setMaterialName("lp_tank_materialblue");
}
// Create a child scene node from tank body's scene node and attach the tank turret to it
Ogre::SceneNode* mTankTurretNode = mTankBodyNode->createChildSceneNode();
mTankTurretNode->attachObject(tankTurret);
// Move it above tank body
mTankTurretNode->translate(0.f, 3.f, 0.f);
// Create a child scene node from tank turret's scene node and attach the tank barrel to it
Ogre::SceneNode* mTankBarrelNode = mTankTurretNode->createChildSceneNode();
mTankBarrelNode->attachObject(tankBarrel);
// Move it to the appropriate position on the turret
mTankBarrelNode->translate(-30.f, 10.f, -1.5f);
//WEE ADDED HERE TO MAKE THE MANUAL OBJECT
std::string pathName = "AStarPath" + std::to_string(tankNumber);
Ogre::ManualObject* aStarPath = mSceneMgr->createManualObject(pathName);
aStarPath->clear();
aStarPath->setQueryFlags(0);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(aStarPath);
Tank* newTank = new Tank(mSceneMgr->createBillboardSet(), mSceneMgr->createBillboardSet(),
mTankBodyNode, mTankTurretNode, mTankBarrelNode, this, pathFindingGraph, mPathFinder, aStarPath, side, mSceneMgr, tankBody, tankTurret, tankBarrel);
newTank->resetAll();
if (side == 1)
{
tankSideA.insert(newTank);
} else if(side == 2){
tankSideB.insert(newTank);
}
return newTank;
}