本文整理汇总了C++中Projectile::autorelease方法的典型用法代码示例。如果您正苦于以下问题:C++ Projectile::autorelease方法的具体用法?C++ Projectile::autorelease怎么用?C++ Projectile::autorelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projectile
的用法示例。
在下文中一共展示了Projectile::autorelease方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Projectile
Projectile *Projectile::createModel(ProjectileTypes type) {
Projectile *retval = new Projectile();
if (retval && retval->initModelWithType(type)) {
retval->autorelease();
return retval;
}
CC_SAFE_DELETE(retval);
return NULL;
}
示例2: AddRocket
void GameWorld::AddRocket(Vehicle* shooter, Vector2D target)
{
Projectile* pProjectile = new Projectile_Rocket(shooter, target);
pProjectile->autorelease();
// 添加进来
m_Projectiles.push_back(pProjectile);
pProjectile->initWithFile("media/image/missile.png");
if (m_pUILayer)
{
m_pUILayer->addChild(pProjectile);
}
}
示例3: createProjectile
Projectile* Projectile::createProjectile(string filename, Vec2 p, Vec2 speed, string name)
{
Projectile* ob = new Projectile();
if(ob && ob->initProjectile(filename, p, speed, name))
{
ob->autorelease();
return ob;
}
CC_SAFE_DELETE(ob);
return NULL;
}
示例4: create
Projectile* Projectile::create(Vec2 position, Vec2 direction)
{
Projectile* bullet = new Projectile();
if (!bullet->init())
{
CC_SAFE_DELETE(bullet);
return nullptr;
}
bullet->autorelease();
bullet->setPosition(position);
bullet->setRotation(-CC_RADIANS_TO_DEGREES(direction.getAngle()));
bullet->direction = direction;
return bullet;
}
示例5: create
Projectile* Projectile::create( GameCharacterAttribute& att, ProjectileTypeEnum type, void* extraInfo, int ownerId )
{
Projectile* pRet = nullptr;
/**
* 这里是根据子弹类型通过“组装”的方式来,主要是发现采用继承的方式会出现
* 各种蛋疼的事情
*/
switch (type)
{
case PROJECTILE_TYPE_GALAXO_BALL: // 闪电球
{
// 单体攻击型
pRet = new ProjectileMonomerAttack(att, (int)extraInfo);
// @[email protected] 装配移动引擎
pRet->setMovingPart(new ProjectileTrackMovingPart((int)extraInfo));
pRet->getMovingPart()->setRate(1800);
// @[email protected] 装配显示部分
pRet->setShapePart(new ProjectileTypeOneShapePart("xuejingling-texiao", "atk"));
break;
}
case PROJECTILE_TYPE_ZEUS_FLY_HAMMER: // 飞锤
{
// 单体攻击
pRet = new ProjectileMonomerAttack(att, (int)extraInfo);
pRet->setMovingPart(new ProjectileTrackMovingPart((int)extraInfo));
pRet->getMovingPart()->setRate(1000);
pRet->setShapePart(new ProjectileTypeOneShapePart("zhousi-wuqi", "atk3", true));
break;
}
case PROJECTILE_TYPE_PIG_FLY_KNIFE: // 野猪飞刀
{
pRet = new ProjectileMonomerAttack(att, (int)extraInfo);
pRet->setMovingPart(new ProjectileTrackMovingPart((int)extraInfo));
pRet->getMovingPart()->setRate(1000);
pRet->setShapePart(new ProjectileTypeOneShapePart("Pig-wuqi", "atk2", true));
break;
}
case PROJECTILE_TYPE_NIU_FLY_SHIELD: // 牛的飞盾
{
pRet = new ProjectileMonomerAttack(att, (int)extraInfo);
pRet->setMovingPart(new ProjectileTrackMovingPart((int)extraInfo));
pRet->setShapePart(new ProjectileTypeOneShapePart("Niu-wuqi", "atk2", true));
break;
}
case PROJECTILE_TYPE_THEIF_FLY_DAGGER: // 刺客的飞匕首
{
pRet = new ProjectileMonomerAttack(att, (int)extraInfo);
pRet->setMovingPart(new ProjectileTrackMovingPart((int)extraInfo));
pRet->setShapePart(new ProjectileTypeOneShapePart("Theif-wuqi", "atk2", true));
break;
}
default:
break;
}
if (pRet != nullptr)
{
pRet->m_projectileType = type;
pRet->m_ownerId = ownerId;
pRet->autorelease();
// 注册到管理器中
ProjectileMgr->addProjectile(pRet);
// 添加到地图上
GameMap::instance()->addProjectile(pRet);
// 开始发射的表现
pRet->getShapePart()->onLaunchStart();
}
return pRet;
}