本文整理汇总了C++中Tower::setSkin方法的典型用法代码示例。如果您正苦于以下问题:C++ Tower::setSkin方法的具体用法?C++ Tower::setSkin怎么用?C++ Tower::setSkin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tower
的用法示例。
在下文中一共展示了Tower::setSkin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTower
Tower* ObjectFactory::createTower(TowerStructDTO* towerStructDTO, b2World* world)
{
TowerDTO* towerDTO = DataCollector::getInstance()->getTowerDTOByKey(towerStructDTO->id.c_str());
Tower* tower = NULL;
if(strcasecmp(towerStructDTO->type.c_str(), "main") == 0)
{
tower = MainCrystal::create();
// CCLOG("main");
}
else
{
tower = Tower::create();
// CCLOG("tower");
}
tower->setOriginCharacterData(towerDTO->data);
//Create Animation
string run = towerDTO->animation;
string attack = towerDTO->animation;
string idle = towerDTO->animation;
string fall = towerDTO->animation;
string fly = towerDTO->animation;
string jump = towerDTO->animation;
string die = towerDTO->animation;
tower->runAnimation = DataCollector::getInstance()->getAnimationObjectByKey(run.append(RUN).c_str());
tower->attackAnimation = DataCollector::getInstance()->getAnimationObjectByKey(attack.append(ATTACK).c_str());
tower->jumpAnimation = DataCollector::getInstance()->getAnimationObjectByKey(jump.append(JUMP).c_str());
tower->idleAnimation = DataCollector::getInstance()->getAnimationObjectByKey(idle.append(IDLE).c_str());
tower->fallAnimation = DataCollector::getInstance()->getAnimationObjectByKey(fall.append(FALL).c_str());
tower->flyAnimation = DataCollector::getInstance()->getAnimationObjectByKey(fly.append(FLY).c_str());
tower->dieAnimation = DataCollector::getInstance()->getAnimationObjectByKey(die.append(DIE).c_str());
tower->setSoundData(SoundManager::loadCharacterSoundData(towerDTO->soundId.c_str()));
// if( tower->attackAnimation != NULL)
// {
// tower->attackAnimation->getAnimation()->setDelayPerUnit(tower->getOriginCharacterData().getAttackSpeed());
// }
//body
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.angle = ccpToAngle(ccp(0,0));
bodyDef.fixedRotation=true;
b2Body *body = world->CreateBody(&bodyDef);
gbox2d::GB2ShapeCache *sc = gbox2d::GB2ShapeCache::sharedGB2ShapeCache();
sc->addFixturesToBody(body, towerDTO->body.c_str());
tower->setSpriteAnchorPoint(sc->anchorPointForShape(towerDTO->body.c_str()));
tower->getSprite()->setAnchorPoint(sc->anchorPointForShape(towerDTO->body.c_str()));
tower->setSkin(body, tower->getSprite());
//
tower->setSensor(towerDTO->towerSensorId.c_str());
tower->setSkill(NORMAL_ATTACK, SkillFactory::createSkill(towerDTO->data.getSkill0().c_str(), world, tower, false, SKILL_0_BTN));
// tower->setSkill1(SkillFactory::createSkill(towerDTO->data.getSkill1().c_str(), world, tower, false, SKILL_1_BUTTON));
// tower->setSkill2(SkillFactory::createSkill(towerDTO->data.getSkill2().c_str(), world, tower, false, SKILL_2_BUTTON));
tower->setPositionInPixel(ccp(towerStructDTO->positionX,towerStructDTO->positionY));
tower->setGroup(towerStructDTO->group);
tower->setSoundData(SoundManager::loadCharacterSoundData(towerDTO->soundId.c_str()));
tower->onCreate();
return tower;
}