当前位置: 首页>>代码示例>>C++>>正文


C++ CInstance::getEntity方法代码示例

本文整理汇总了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);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:9,代码来源:tool_select_rotate.cpp

示例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);
	}
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:11,代码来源:tool_select_rotate.cpp

示例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;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:16,代码来源:tool_select_rotate.cpp

示例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);
			}
		}
	}
}
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:85,代码来源:character_3d.cpp


注:本文中的CInstance::getEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。