本文整理汇总了C++中CInstance::getEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ CInstance::getEntity方法的具体用法?C++ CInstance::getEntity怎么用?C++ CInstance::getEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInstance
的用法示例。
在下文中一共展示了CInstance::getEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cancelAction
// ***************************************************************
void CToolSelectRotate::cancelAction(CInstance &instance)
{
//H_AUTO(R2_CToolSelectRotate_cancelAction)
CEntityCL *entity = instance.getEntity();
nlassert(entity);
getEditor().requestRollbackLocalNode(instance.getId(), "Angle");
setRotateInProgress(false, instance);
}
示例2: updateAction
// ***************************************************************
void CToolSelectRotate::updateAction(CInstance &instance)
{
//H_AUTO(R2_CToolSelectRotate_updateAction)
CEntityCL *entity = instance.getEntity();
if (entity)
{
setMouseCursor("r2ed_tool_rotating.tga");
setEntityAngle(*entity, instance, (float) ((getMouseX() - _MouseStartX) * NLMISC::Pi / 180) + _StartAngle);
}
}
示例3: isActionPossibleOn
// ***************************************************************
bool CToolSelectRotate::isActionPossibleOn(const CInstance &instance) const
{
//H_AUTO(R2_CToolSelectRotate_isActionPossibleOn)
CInstance &mutableInstance = const_cast<CInstance &>(instance);
CDisplayerVisual *dv = mutableInstance.getDisplayerVisual();
if (dv && dv->getActualDisplayMode() != CDisplayerVisual::DisplayModeVisible)
{
return false;
}
if (instance.getEntity() != NULL)
{
return !instance.getClass()["NameToProp"]["Angle"].isNil();
}
return false;
}
示例4: getEditor
// ------------------------------------------------------------------------------------------------
void CCharacter3D::setAnim (uint animID)
{
CCharacterCL * character = NULL;
if(!_CopyAnim)
{
_CurrentSetup.AnimPlayed = animID;
if (_CurrentSetup.Male)
{
if (animID >= _AnimMale.size()) return;
animID = _AnimMale[animID].AnimId;
}
else
{
if (animID >= _AnimFemale.size()) return;
animID = _AnimFemale[animID].AnimId;
}
}
else
{
CInstance * selectedInst = getEditor().getSelectedInstance();
if(!selectedInst) return;
CEntityCL * entity = selectedInst->getEntity();
if(!(entity && ((character=dynamic_cast<CCharacterCL*>(entity))!=NULL)))
return;
animID = character->playList()->getAnimation(MOVE);
_CurrentSetup.AnimPlayed = animID;
}
float animSpeedFactor = 0.9f + 0.2f * NLMISC::frand(1);
if (_PlayList)
{
if(_CopyAnim)
{
_PlayList->setTimeOrigin(MOVE, character->playList()->getTimeOrigin(MOVE));
if(character->playList()->getAnimation(MOVE)!=_PlayList->getAnimation(MOVE))
{
_PlayList->setAnimation(MOVE, animID);
_PlayList->setSpeedFactor(MOVE, character->playList()->getSpeedFactor(MOVE));
_PlayList->setWrapMode(MOVE, character->playList()->getWrapMode(MOVE));
}
}
else
{
_PlayList->setAnimation(MOVE, animID);
_PlayList->setSpeedFactor(MOVE, animSpeedFactor);
_PlayList->setTimeOrigin(MOVE, TimeInSec);
_PlayList->setWrapMode(MOVE, UPlayList::Repeat);
}
}
if (_FacePlayList)
{
uint faceAnimId=UPlayList::empty;
if(_AnimationSet && animID<_AnimationSet->getNumAnimation())
{
// build the anim name of the face
string faceAnimName= COptionsAnimationSet::getFaceAnimName(_AnimationSet->getAnimationName(animID));
// find the face anim for this name
faceAnimId= _AnimationSet->getAnimationIdByName(faceAnimName);
if(faceAnimId==UAnimationSet::NotFound)
faceAnimId= UPlayList::empty;
}
_FacePlayList->setAnimation(MOVE, faceAnimId);
if(faceAnimId!=UPlayList::empty)
{
if(_CopyAnim)
{
_FacePlayList->setTimeOrigin(MOVE, character->facePlayList()->getTimeOrigin(MOVE));
_FacePlayList->setSpeedFactor(MOVE, character->facePlayList()->getSpeedFactor(MOVE));
_FacePlayList->setWrapMode(MOVE, character->facePlayList()->getWrapMode(MOVE));
}
else
{
_FacePlayList->setSpeedFactor(MOVE, animSpeedFactor);
_FacePlayList->setTimeOrigin(MOVE, TimeInSec);
_FacePlayList->setWrapMode(MOVE, UPlayList::Repeat);
}
}
}
}