本文整理汇总了C++中Character::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Character::GetPosition方法的具体用法?C++ Character::GetPosition怎么用?C++ Character::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character::GetPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckCollision
bool Bullet::CheckCollision(Character &character)
{
if (m_isActive && character.GetisAlive())
{
int nbrIteration = 10;
if (character.GetDimension().x <= character.GetDimension().y && character.GetDimension().x <= character.GetDimension().z)
nbrIteration = ceil(m_vitesse.x / character.GetDimension().x);
if (character.GetDimension().y <= character.GetDimension().x && character.GetDimension().y <= character.GetDimension().z)
nbrIteration = ceil(m_vitesse.y / character.GetDimension().y);
if (character.GetDimension().z <= character.GetDimension().y && character.GetDimension().z <= character.GetDimension().x)
nbrIteration = ceil(m_vitesse.z / character.GetDimension().z);
for (int i = 0; i < nbrIteration; i++)
{
if (m_LastPos.x + directionVector.x / nbrIteration * i >= character.GetPosition().x - character.GetDimension().x / 2
&& m_LastPos.x + directionVector.x / nbrIteration * i < character.GetPosition().x + character.GetDimension().x / 2
&& m_LastPos.y + directionVector.y / nbrIteration * i >= character.GetPosition().y
&& m_LastPos.y + directionVector.y / nbrIteration * i < character.GetPosition().y + character.GetDimension().y
&& m_LastPos.z + directionVector.z / nbrIteration * i >= character.GetPosition().z - character.GetDimension().z / 2
&& m_LastPos.z + directionVector.z / nbrIteration * i < character.GetPosition().z + character.GetDimension().z / 2)
{
//f(x) = -1 * 1.02 ^ (x + 10) + 50
character.GetDamage(-1 * pow(1.04, m_distance + 10) + m_damage);
m_isActive = false;
return true;
}
}
}
return false;
}
示例2: OnEnter
//----------------------------------------------------------------------------
void SkillStepLink::OnEnter (SkillInstance *instance)
{
SkillStep::OnEnter(instance);
Skill *skill = instance->GetSkill();
Character *character = skill->GetCharacter();
Scene *scene = character->GetScene();
Node *sceneNode = DynamicCast<Node>(scene->GetSceneNode());
APoint charPos = character->GetPosition();
int aimTarget = instance->GetAimTarget();
Character *aimTargetChar = DynamicCast<Character>(scene->GetActorByID(
aimTarget));
if (aimTargetChar)
{
SkillActorLinkPtr skillActorLink = new0 SkillActorLink();
instance->AddSkillActor(aimTarget, skillActorLink);
skillActorLink->SetID(10000+scene->GetNextID());
skillActorLink->Initlize();
if (!mSelfEffectFilename.empty())
skillActorLink->SetMovableFilename(mSelfEffectFilename);
skillActorLink->SetFromActorID(character->GetID());
skillActorLink->SetFromActorAnchor(mSelfEffectAnchor);
if (IsLinkToActor())
{
skillActorLink->SetTargetType(SkillActorLink::TT_ACTOR);
skillActorLink->SetToActorID(aimTarget);
}
else
{
APoint toPos = charPos + mLinkDir * mSpeed * mLinkToTime;
skillActorLink->SetTargetType(SkillActorLink::TT_POSITION);
skillActorLink->SetToPosition(toPos);
}
skillActorLink->SetPosition(charPos);
skillActorLink->SetLinkSpeed(GetSpeed());
skillActorLink->ShowHelpMovable(false);
scene->AddActor(skillActorLink);
skillActorLink->Start();
if (!mSelfPosEffectFilename.empty())
{
APoint pos = character->GetPosition();
Transform trans;
trans.SetTranslate(pos);
trans.SetRotate(character->GetMovable()->WorldTransform.GetRotate());
if (!mSelfPosEffectFilename.empty())
{
Node *anchor = character->GetAnchor(mSelfPosEffectAnchor);
if (anchor)
{
//trans = anchor->WorldTransform;
trans.SetTranslate(anchor->WorldTransform.GetTranslate());
}
}
Object *obj = PX2_RM.BlockLoadShareCopy(mSelfPosEffectFilename, false,
false, true);
if (obj)
{
EffectNode *effectNode = DynamicCast<EffectNode>(obj);
if (effectNode)
{
effectNode->SetSelfCtrled(true);
effectNode->WorldTransform = trans;
effectNode->WorldTransformIsCurrent = true;
sceneNode->AttachChild(effectNode);
effectNode->ResetPlay();
PX2_DM.AddDeletingObj(effectNode, mSelfPosEffectTime, 3.0f);
}
}
}
}
else
{
if (PX2_PROJ.IsInEditor())
{
SkillActorLinkPtr skillActorLink = new0 SkillActorLink();
instance->AddSkillActor(aimTarget, skillActorLink);
skillActorLink->SetID(10000+scene->GetNextID());
skillActorLink->Initlize();
if (!mSelfEffectFilename.empty())
//.........这里部分代码省略.........