本文整理汇总了C++中CMoveShape::GetTileY方法的典型用法代码示例。如果您正苦于以下问题:C++ CMoveShape::GetTileY方法的具体用法?C++ CMoveShape::GetTileY怎么用?C++ CMoveShape::GetTileY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMoveShape
的用法示例。
在下文中一共展示了CMoveShape::GetTileY方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
int SkillTracer::Run(BaseAI *ai)
{
if(timeGetTime() >= m_EndTime)
{
return TIMEOUT;
}
CMoveShape *self = ai->GetOwner();
CServerRegion *rgn = dynamic_cast<CServerRegion*>(self->GetFather());
CMoveShape *target = AIUtils::FindShape(rgn, m_TargetID);
if(target == NULL)
{
return FAILED;
}
#ifdef MONSTER_DIS_FLOAT
float dis = self->RealDistanceF(target);
#else
long dis = self->Distance(target);
#endif
long dx = target->GetTileX();
long dy = target->GetTileY();
if(dis > m_SkillMaxDis)
{
ai->Move(dx, dy);
}
else if(dis < m_SkillMinDis)
{
long dir = GetLineDir(dx, dy, self->GetTileX(), self->GetTileY());
ai->Move(dir);
}
else
{
return Okay;
}
return RUNNING;
}
示例2: Execute
void EscapeStateNormal::Execute(BaseType::EntityType *entity)
{
if (entity == NULL)
{
LogError(AI_MODULE, "entity is null.");
return;
}
MonsterAI *monsterAI = static_cast<MonsterAI*>(entity);
// check cycle action
AIState *cycle_action = entity->GetState(ST_CYCLE);
CycleStateExecutor cycleExecutor;
if(cycleExecutor.Execute(cycle_action, entity))
{
return ;
}
// check return peace
if(monsterAI->GetFightObj().CheckReturnPeace())
{
return ;
}
CMoveShape *target = entity->GetTarget();
if(target == NULL)
{
LogError(AI_MODULE, "target is null.");
monsterAI->GetFightObj().LoseTarget();
entity->Resume(OPER_FAILED_TIME);
}
else
{
CMoveShape *owner = entity->GetOwner();
long dir = GetLineDir(target->GetTileX(), target->GetTileY(),
owner->GetTileX(), owner->GetTileY());
entity->Move(dir);
}
}
示例3: Execute
//执行
void COpDirec::Execute(CMoveShape* pShape)
{
if (pShape == m_pParam->pUser && m_eDir!=eDir_Mouse)
{
return;
}
CMoveShape *pMoveShape = GetOpShape(pShape);
long lX = 0,lY = 0;
if(pMoveShape == NULL)
{
lX = m_pParam->nMouseX;
lY = m_pParam->nMouseY;
float fDir =GetRadianDir((float)m_pParam->pUser->GetTileX(),(float)m_pParam->pUser->GetTileY(),(float)lX,(float)lY);
m_pParam->pUser->SetDir((long)fDir);
//SendChangeDir(m_pParam->pUser);
return;
}
if(m_eDir == eDir_Mouse)
{
lX = m_pParam->nMouseX;
lY = m_pParam->nMouseY;
}
else if(m_eDir == eDir_Self)
{
lX = m_pParam->pUser->GetTileX();
lY = m_pParam->pUser->GetTileY();
}
else if(m_eDir == eDir_Dest && pShape )//&&
{
lX = pShape->GetTileX();
lY = pShape->GetTileY();
if (m_pParam->pMouseShape)
{
lX = m_pParam->pMouseShape->GetTileX();
lY = m_pParam->pMouseShape->GetTileY();
}
}
if((lX !=0 || lY !=0) && pMoveShape)
{
float fDir =GetRadianDir((float)pMoveShape->GetTileX(),(float)pMoveShape->GetTileY(),(float)lX,(float)lY);
pMoveShape->SetDirEx(fDir);
//SendChangeDir(pMoveShape);
}
}
示例4: AI
void CFighterPet::AI()
{
if( m_pMaster && m_pRegion )
{
CMoveShape* pAimShape = m_pMaster;
long lX = GetTileX();
long lY = GetTileY();
long lAimX = pAimShape->GetTileX();
long lAimY = pAimShape->GetTileY();
// ¸úËæÖ÷ÈËÒƶ¯
if( abs(lX-lAimX) > 3 || abs(lY-lAimY) > 3 )
{
if( IsActive())
AutoMoveAI(lAimX,lAimY);
}
}
}
示例5: AI
void CSummonPet::AI()
{
if( m_pMaster && m_pRegion )
{
CMoveShape* pAimShape = m_pMaster;
long lFightMode = PetFightAI();
long lX = GetTileX();
long lY = GetTileY();
long lAimX = pAimShape->GetTileX();
long lAimY = pAimShape->GetTileY();
int nRet = -1;
switch(lFightMode)
{
case FMR_Trace_Far:
if( IsActive() )
{
long x = m_pCurAtkShape->GetPosX();
long y = m_pCurAtkShape->GetPosY();
nRet = AutoMoveAI(x,y);
}
break;
case FMR_Trace_Near:
case FMR_Attack:
{
UsePetSkill(m_lCurUseSkillPos);
}
break;
case FMR_No_TARGET:
{
// ¸úËæÖ÷ÈËÒƶ¯
if( abs(lX-lAimX) > 3 || abs(lY-lAimY) > 3 )
{
if( IsActive())
AutoMoveAI(lAimX,lAimY);
}
}
break;
default: break;
}
}
}
示例6: SearchEnemy
bool PetAI::SearchEnemy()
{
CPet *owner = (CPet*) m_Owner;
CMoveShape *host = owner->GetHost();
if(NULL == host)
{
LogError(AI_MODULE, "m_Owner->GetHost() error.");
return false;
}
CMoveShape *target = GetTarget();
// 当前有追踪目标
if(target != NULL)
{
long dis = owner->Distance(target);
long tracDis = owner->GetTrackRange();
if(!target->IsDied() &&
tracDis > dis &&
!target->IsGod())
{
return true;
}
}
// 寻找所在场景
CServerRegion *region = dynamic_cast<CServerRegion*>(host->GetFather());
if(NULL == region)
{
return false;
}
vector<CShape*> vOut;
region->FindAroundObject(owner, TYPE_PLAYER, vOut);
region->FindAroundObject(owner, TYPE_MONSTER, vOut);
region->FindAroundObject(owner, TYPE_PET, vOut);
bool ret = false;
map<long, CMoveShape*> AroundObjs;
long distance = 0;
for(size_t i=0; i < vOut.size(); ++i)
{
target = (CMoveShape*)vOut[i];
if(target != NULL &&
target->IsDied() &&
!target->IsGod() &&
target->IsAttackAble(owner))
{
distance = m_Owner->Distance(target->GetTileX(), target->GetTileY());
AroundObjs[distance] = target;
ret = true;
}
}
if(ret) // 满足条件设置对象
{
map<long, CMoveShape*>::iterator itr = AroundObjs.begin();
target = itr->second;
SetTarget(target->GetExID(), target->GetType());
//if(PET_TYPE_TRAP == owner->GetPetType())
//{
// owner->SetActTime(0, 0); // 避免寻敌后无法攻击
// owner->OnTrapSpring();
//}
}
return true;
}