本文整理汇总了C++中Hero::GetCOREs方法的典型用法代码示例。如果您正苦于以下问题:C++ Hero::GetCOREs方法的具体用法?C++ Hero::GetCOREs怎么用?C++ Hero::GetCOREs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero::GetCOREs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UseSkill
void Robot::UseSkill()
{
if (!startattack)
{
HGE *hge = hgeCreate(HGE_VERSION);
float x, y;
hge->Input_GetMousePos(&x, &y);
backx = GetX();
backy = GetY();
switch (coretype)
{
//攻击型
//开始攻击
case Attack:
if (x<ACT_START_X || x>ACT_END_X || y<ACT_START_Y || y>ACT_END_Y)
{
if (!tremble)
tremble = 20;
return;
}
else
{
SetCollisionRange(40);
SetPos(x, y);
}
break;
//触发技能型
//跟hero做intercation将自身赋给hero然后自杀
case Magic:
break;
//BUFF型
//施放技能
case Buff:
{
int count = 0;
Hero *a = dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()));
for (int i = 0; i < STD_CORES; i++)
{
Robot *b = dynamic_cast<Robot*>(a->GetCOREs(i));
if (b && b->IsActive())
{
if (b->GetInnerCode() == GetInnerCode())
{
b->Suicide();
a->Interaction(b);
}
else
if (b->GetCoreType() == Buff)
count++;
}
}
SetSpeed(1500);
SetAim(25 + count * 50, 175);
}
break;
}
startattack = true;
}
}
示例2: Action
void Robot::Action()
{
switch (GetType())
{
case Left:
if (!startattack)
{
if (!trigger)
{
if (coretype != Eternity)
{
HGE *hge = hgeCreate(HGE_VERSION);
float x, y;
hge->Input_GetMousePos(&x, &y);
int dis = GetDistance(x, y);
if (dis < 20)
{
if (hge->Input_KeyDown(HGEK_LBUTTON))
{
trigger = true;
backx = GetX();
backy = GetY();
}
else
{
if (hge->Input_KeyDown(HGEK_RBUTTON))
Suicide(true);
}
}
}
}
else
{
ObjectPool::GetObjPool().LockOnGameObject(this);
if (runback)
{
if (GoToAnotherPos(backx,backy))
{
trigger = false;
runback = false;
SetSpeed(0);
}
}
else
{
HGE *hge = hgeCreate(HGE_VERSION);
float x, y;
hge->Input_GetMousePos(&x, &y);
SetPos(x, y);
if (hge->Input_KeyUp(HGEK_LBUTTON))
{
if (x<ACT_START_X || x>ACT_END_X || y<ACT_START_Y || y>ACT_END_Y)
{
runback = true;
SetSpeed(1200);
}
else
{
switch (coretype)
{
//攻击型
//开始攻击
case Attack:
SetCollisionRange(40);
SetSolid(true);
SetBlock(true);
break;
//触发技能型
//跟hero做intercation将自身赋给hero然后自杀
case Magic:
dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()))->SetSkill(GetInnerCode() + 300);
Suicide();
break;
//BUFF型
//施放技能
case Buff:
{
int count = 0;
Hero *a = dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()));
for (int i = 0; i < STD_CORES; i++)
{
Robot *b = dynamic_cast<Robot*>(a->GetCOREs(i));
if (b && b->IsActive())
{
if (b->GetInnerCode() == GetInnerCode())
{
b->Suicide();
a->Interaction(b);
}
else
if (b->GetCoreType() == Buff)
count++;
}
}
SetSpeed(1500);
SetAim(25+count * 50, 175);
}
break;
}
//.........这里部分代码省略.........