Esempio n. 1
0
void CMemberAI::MemberAutoSynPos(bool bExtraMove)
{
    CDummyAI* pDummyAI = GetGroupLeaderDummyAI();
    if (!pDummyAI)
        return;
    CCharacterDictator* pDummyCharacter = pDummyAI->GetCharacter();
    if (!pDummyCharacter)
        return;
    CFighterDictator* pDummyFighter = pDummyCharacter->GetFighter();
    if(!pDummyFighter)
        return;
    CFPos destPos = GetSelfCorrectPos();
    CFPos ownPos;
    GetCharacter()->GetPixelPos(ownPos);
    bool bWalkState = pDummyAI->m_bDefaultWalkState;
    float fSpeed = bWalkState ?pDummyFighter->m_WalkSpeed.Get(pDummyFighter) :
                   pDummyFighter->m_RunSpeed.Get(pDummyFighter);

    if (ownPos.Dist(destPos)<eGridSpanForObj/2)
    {
        if (bExtraMove)
            pDummyAI->CheckMemberSynState();
        else
            MoveToPixelInLinePath(destPos,fSpeed,bWalkState);
        return;
    }

    CVector2f vecf;
    vecf.x = destPos.x - ownPos.x;
    vecf.y = destPos.y - ownPos.y;
    CDir dir;
    dir.Set(vecf);
    dir.Get(vecf);

    if(bExtraMove)
    {
        float fLineDst = fSpeed*0.5f*eGridSpanForObj;
        destPos.x = destPos.x + fLineDst*vecf.x;
        destPos.y = destPos.y + fLineDst*vecf.y;
    }

    fSpeed += 0.3f;
    MoveToPixelInLinePath(destPos,fSpeed,bWalkState);
}
Esempio n. 2
0
bool CTargetDirectionFX::RenderCallback( IEffectUnit* pUnit, CMatrix& matWorld, uint32 uCurTime, RenderObjStyle* pRORS )
{
	IEffectUnitProp* pProp = pUnit->GetProp();
	if(/* !bAlphaBlend ||*/ !pUnit->IsInRenderTime() )
	{	
		return false;
	}

	CEntityClient* pEntity = CEntityClientManager::GetInst()->GetEntityByID( CEntityClientManager::GetInst()->GetDirectorID());
	CFPos Pos = pEntity->GetPixelPos();
	CVector2f vec2f(m_Pos.x-Pos.x,m_Pos.y-Pos.y);
	CDir dir;
	dir.Set(vec2f);
	float fRotate = dir.uDir* CMath::pi *2/256;
	CVector3f vec3f =matWorld.GetAxis(3);
	matWorld.SetRotateY(fRotate);
	matWorld._41 = vec3f.x;
	matWorld._42 = vec3f.y;
	matWorld._43 = vec3f.z;
	return true;
}