本文整理汇总了C++中Fish::getDeleted方法的典型用法代码示例。如果您正苦于以下问题:C++ Fish::getDeleted方法的具体用法?C++ Fish::getDeleted怎么用?C++ Fish::getDeleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fish
的用法示例。
在下文中一共展示了Fish::getDeleted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateFish
void GameLayer::updateFish(float dt)
{
vector< int >::iterator it = m_currentFish.begin();
while(it != m_currentFish.end()) {
Fish * fish = (Fish *)this->getFishes()->getObjectAtIndex(*it);
if(fish->getDeleted()){
fish->setDeleted(false);
fish->setVisible(false);
it = m_currentFish.erase(it);
}
else ++it;
}
_timeStampAddFish += dt * 20;
if(_timeStampAddFish > _nextTimeStampAddFish){
int _time = _timeStampAddFish / DELTA_ADDFISH;
// Check current avaible Fish Generation Time
this->setCrtTime(_time);
this->addFish();
_nextTimeStampAddFish = _timeStampAddFish + DELTA_ADDFISH;
if(this->getCrtTime() > 180){
int randomScript = (int)(CCRANDOM_0_1() * 100) % MAX_SCRIPT_SIZE;
this->setCrtScript(randomScript + 1);
this->setCrtTime(0);
_nextTimeStampAddFish = _timeStampAddFish = 0;
}
}
}
示例2: updateBullet
void GameLayer::updateBullet(float dt)
{
fireBullet(dt);
Ref *pBulletObj = NULL;
CCARRAY_FOREACH(m_pBullets, pBulletObj)
{
Bullet *pBullet = (Bullet *)pBulletObj;
if (pBullet->getCaught())
continue;
bool caught = false;
bool hit = false;
for(std::vector<int>::iterator it = m_currentFish.begin();it != m_currentFish.end();it++){
int index = *it;
Fish * fish = (Fish *)this->getFishes()->getObjectAtIndex(index);
if(!fish->getVisible() && !fish->getDeleted()){
continue;
}
Rect hittestRect = shrinkRect(fish->getBounding(), 0.65f, 0.8f);
if (hittestRect.containsPoint(pBullet->getSpriteBullet()->getPosition()))
{
fish->hit(pBullet->getPower());
hit = true;
if (fish->getHP() <= 0){
caught = true;
// Add animation coin
this->addCoin(fish->getSprite()->getPositionX(),fish->getSprite()->getPositionY(),fish->getCoin(),"COMBO");
auto label = Label::create();
if(fish->getIsInstance()){
label->setTextColor(Color4B::ORANGE);
label->enableOutline(Color4B::WHITE,4);
label->setPosition(fish->getSprite()->getPosition());
label->setString(StringUtils::format("Perfect \n+ %d",fish->getCoin()));
label->setSystemFontSize(26);
}
else{
label->setTextColor(Color4B::YELLOW);
label->enableOutline(Color4B::WHITE,3);
label->setPosition(fish->getSprite()->getPosition());
label->setString(StringUtils::format("+ %d",fish->getCoin()));
label->setSystemFontSize(20);
}
label->setHorizontalAlignment(TextHAlignment::CENTER);
label->setVerticalAlignment(TextVAlignment::CENTER);
label->runAction(Sequence::create(
MoveBy::create(0.5f,Vec2(0,10)),
FadeOut::create(0.5f),
RemoveSelf::create(true),
NULL));
this->addChild(label);
int crtXP = User::Instance().getXP();
crtXP ++ ;
User::Instance().setXP(crtXP);
User::Instance().save();
this->updateXP();
fish->showCaught();
}
break;
}
}
if (caught)
{
pBullet->showNet();
}
else
{
if (hit)
{
pBullet->showSmoke();
}
}
}