本文整理汇总了C++中Character::GetOrigBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ Character::GetOrigBlock方法的具体用法?C++ Character::GetOrigBlock怎么用?C++ Character::GetOrigBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character::GetOrigBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectCreature
//.........这里部分代码省略.........
{
commandWindow->SetShow(true);
commandWindow->SetBindChar(selectChar);
}
}
}
//其他情况
else
{
Character* lastChar = GetCreature(nLastSelect);
if(lastChar != NULL)
{
//上次点的是别的友方
if(lastChar->GetCamp() == eCamp_Friend)
{
if(lastChar->GetFinish() && !selectChar->GetFinish())
{
m_nSelectNum = selectChar->GetNum();
selectChar->SetActionStage(eActionStage_MoveStage);
}
// //上次的友方返回至待命阶段
// lastChar->SetActionStage(eActionStage_WaitStage);
// selectChar->SetActionStage(eActionStage_MoveStage);
}
else if(lastChar->GetCamp() == eCamp_Enemy)
{
if(!selectChar->GetFinish())
{
m_nSelectNum = selectChar->GetNum();
selectChar->SetActionStage(eActionStage_MoveStage);
}
}
}
else
//这里是错误分支,不可以运行到这里
return;
}
}
else if (selectChar->GetCamp() == eCamp_Enemy)
{
Character* lastChar = GetCreature(nLastSelect);
if(lastChar!=NULL)
{
if(lastChar->GetCamp()==eCamp_Friend)
{
if(lastChar->GetActionStage() == eActionStage_AttackStage)
{
//判断是否可以攻击到选中单位
if(lastChar->CanHitTarget(selectChar))
{
lastChar->SetTarget(selectChar->GetNum());
lastChar->GeginHit();
m_nSelectNum = -1;
return;
}
}
}
else if (lastChar->GetCamp() == eCamp_Enemy)
{
m_nSelectNum = selectChar->GetNum();
}
}
else
{
m_nSelectNum = selectChar->GetNum();
}
}
}
}
//点中地面
else
{
if (g_getLButtonState(App::sInstance().GetHGE()) == eLButtonState_Up && !(UISystem::sInstance().GetWindow(eWindowID_Command)->IsOnControl()))
{
if (m_nSelectNum>=0)
{
selectChar = GetCreature(m_nSelectNum);
if (selectChar!= NULL)
{
if(selectChar->GetCamp() == eCamp_Friend && selectChar->GetActionStage() == eActionStage_MoveStage)
{
//判断是否可以移动过去
int length = abs(mouseBlock.xpos - selectChar->GetBlock().xpos) + abs(mouseBlock.ypos - selectChar->GetBlock().ypos);
//超过移动范围
if(length > selectChar->GetMoveAbility())
return;
//移动过去,记录原始位置
selectChar->GetOrigBlock().xpos = selectChar->GetBlock().xpos;
selectChar->GetOrigBlock().ypos = selectChar->GetBlock().ypos;
selectChar->GetOrigDirection() = selectChar->GetCurDirection();
selectChar->Move(mouseBlock.xpos,mouseBlock.ypos);
}
}
}
}
}
}
}
}
示例2: SelectCreature
//.........这里部分代码省略.........
Character* lastChar = GetCreature(nLastSelect);
if(lastChar != NULL)
{
//上次点的是别的友方
if(lastChar->GetCamp() == eCamp_Friend)
{
// //上次的友方返回至待命阶段
// lastChar->SetActionStage(eActionStage_WaitStage);
// selectChar->SetActionStage(eActionStage_MoveStage);
}
else if(lastChar->GetCamp() == eCamp_Enemy)
{
if(!selectChar->GetFinish())
{
m_nSelectNum = selectChar->GetNum();
selectChar->SetActionStage(eActionStage_MoveStage);
}
}
}
else
//这里是错误分支,不可以运行到这里
return;
}
}
else if (selectChar->GetCamp() == eCamp_Enemy)
{
Character* lastChar = GetCreature(nLastSelect);
if(lastChar!=NULL)
{
if(lastChar->GetCamp()==eCamp_Friend)
{
if(lastChar->GetActionStage() == eActionStage_AttackStage)
{
//判断是否可以攻击到选中单位
eAttackRange attackRange = lastChar->GetAttackRange();
int tarX = 0,tarY = 0;
for (MAttackRange::iterator mit=m_mAttackRange.begin();mit!=m_mAttackRange.end();mit++)
{
if(mit->first == attackRange)
{
for (vector<Pair>::iterator it=mit->second.begin();it!=mit->second.end();it++)
{
tarX = it->x + lastChar->GetBlock().xpos;
tarY = it->y + lastChar->GetBlock().ypos;
if(selectChar->GetBlock().xpos == tarX && selectChar->GetBlock().ypos == tarY)
{
//在攻击范围内
lastChar->SetTarget(selectChar->GetNum());
lastChar->GeginHit();
m_nSelectNum = -1;
return;
}
}
}
}
}
}
else if (lastChar->GetCamp() == eCamp_Enemy)
{
m_nSelectNum = selectChar->GetNum();
}
}
else
{
m_nSelectNum = selectChar->GetNum();
}
}
}
}
//点中地面
else
{
if (g_getLButtonState(App::sInstance().GetHGE()) == eLButtonState_Up)
{
if (m_nSelectNum>=0)
{
selectChar = GetCreature(m_nSelectNum);
if (selectChar!= NULL)
{
if(selectChar->GetCamp() == eCamp_Friend && selectChar->GetActionStage() == eActionStage_MoveStage)
{
//判断是否可以移动过去
int length = abs(mouseBlock.xpos - selectChar->GetBlock().xpos) + abs(mouseBlock.ypos - selectChar->GetBlock().ypos);
//超过移动范围
if(length > selectChar->GetMoveAbility())
return;
//移动过去,记录原始位置
selectChar->GetOrigBlock().xpos = selectChar->GetBlock().xpos;
selectChar->GetOrigBlock().ypos = selectChar->GetBlock().ypos;
selectChar->GetOrigDirection() = selectChar->GetCurDirection();
selectChar->Move(mouseBlock.xpos,mouseBlock.ypos);
}
}
}
}
}
}
}
}