Beispiel #1
0
void CPartSnowFlake::Touch( Vector pos, Vector normal, int index )
{
	if( m_bTouched )
	{
		return;
	}

	m_bTouched = true;

	SetRenderFlag( RENDER_FACEPLAYER );

	m_flOriginalBrightness = m_flBrightness;

	m_vVelocity = g_vecZero;

	m_iRendermode = kRenderTransAdd;

	m_flFadeSpeed = 0;
	m_flScaleSpeed = 0;
	m_flDampingTime = 0;
	m_iFrame = 0;
	m_flMass = 1.0;
	m_flGravity = 0;

	m_vColor.x = m_vColor.y = m_vColor.z = 128.0;

	m_flDieTime = gEngfuncs.GetClientTime() + 0.5;

	m_flTimeCreated = gEngfuncs.GetClientTime();
}
Beispiel #2
0
void DexSkinMesh::Init()
{
	m_iRenderFlag = 0;
	m_fAnimateRatio = 1.0f;
	m_eAniType = SkinMeshAnimateType_Loop;
	m_eMeshType = SkinMeshModelType_UnKnown;
	m_iAnimateStartTime = 0;
	m_iAnimateNowTime = 0;
	m_iAnimateEndTime = 0;
	m_iAnimateMaxTime = 0;
	m_pRootJoint = NULL;
	m_bHaveAnimation = true;
	m_bAnimate = true;
	m_iLightFlag = 0;

	m_pRootJoint = new Joint;
	m_pRootJoint->m_pFather = NULL;
	m_pRootJoint->str_name = "root_joint";
	m_pRootJoint->id = _SKIN_MESH_ROOT_JOINT_ID;
	m_pRootJoint->frame_matrix.Identity();
	m_pRootJoint->meshMatrix.Identity();
	m_pRootJoint->localMeshMatrixInvert.Identity();
	m_pRootJoint->world_matrix.Identity();
	m_vecJoints.push_back(m_pRootJoint);
	SetRenderFlag(SKINMESH_RENDER_MESH);
	jointsMatrix = new D3DXMATRIX[sGetMaxJointCount()];
	m_fJointScale = 1.0f;
	InitShader();

	iHideMeshIndex = -1;

}
void ProgressBarNode::SetProtoData( const CoreProto::Editor::ProgressBar& val )
{
	mProtoData = val;
	SetName(val.id());

	CCSprite* sprite=new CCSprite();
	sprite->autorelease();
	FileSystemOrderItem* orderItem=ResourceManager::Instance().InitSprite(sprite,val.image(),val.size());
	if (orderItem==NULL)
	{
		Log::LogErrorFormat("ProgressBarNode:Cannot find image:%s",val.image().file().name().c_str());
		return;
	}

	if(!initWithSprite(sprite))
	{
		Log::LogErrorFormat("Cannot init progress bar:%s",val.id().c_str());
		return;
	}


	Point2F offset=orderItem->GetOffsetOrZero();
	Size2F originalSize=orderItem->GetOriginalSizeOrZero();
	Point2F newAnchorPoint=Point2F(val.anchor().x(),val.anchor().y());

	if (offset!=Point2F::Zero)
	{
		CCSize contentSize=getContentSize();
		newAnchorPoint= LayerEditor::CalculateAnchor(newAnchorPoint,offset,Size2F(contentSize.width,contentSize.height),Size2F(contentSize.width,contentSize.height));
	}

	//setFlipX(val.isfilpx());
	//setFlipY(val.isfilpy());
	setZOrder(val.zorder());
	setVisible(val.isvisible());
	setAnchorPoint(ccp(newAnchorPoint.X,newAnchorPoint.Y));
	if (val.has_scale())
	{
		setScaleX(val.scale().x());
		setScaleY(val.scale().y());
	}
	else
	{
		setScale(1.f);
	}

	setRotation(val.rotation());
	SetRenderFlag((RenderFlag)val.renderflag());

	if (val.isproportionpoint())
	{
		CCSize winSize= CCDirector::sharedDirector()->getWinSizeInPixels();

		setPosition(ccp(val.position().x()*winSize.width,val.position().y()*winSize.height));
	}
	else
	{
		setPosition(ccp(val.position().x(),val.position().y()));
	}
	
	setPercentage(100.f);

	
	setType((CCProgressTimerType)val.type());

	CCPoint midPos = ccp(val.midpoint().x(),val.midpoint().y());
	if (getType() == kCCProgressTimerTypeRadial)
	{
		midPos.x = Math::Clamp(midPos.x,0.001f,0.9999f);
		midPos.y = Math::Clamp(midPos.y,0.001f,0.9999f);
	}
	setMidpoint(midPos);
	setBarChangeRate(ccp(val.changerate().x(),val.changerate().y()));
	setTag(val.tag());
}