Beispiel #1
0
void CPlayer::Increase()
{
	if (!m_pHead)
	{			
		m_pHead = new CSphereEntity(m_pReflectObject, GetHeadRadius(), GetSlice(), GetSlice());

		CSphereEntity *pBody = new CSphereEntity(m_pColorLightObject, GetBodyRadius(), GetSlice(), GetSlice());
		pBody->Create();
		m_listBody.push_back(pBody);
		m_pTail = new CSphereEntity(m_pColorLightObject, GetBodyRadius(), GetSlice(), GetSlice());
		m_pTail->Create();

		ISceneNode *pRootNode = SCENEMGR->GetCurrentScene()->GetRootNode();
		pRootNode->AddChild(pBody);
		pRootNode->AddChild(m_pTail);
		InitPosition();
	}
	else
	{
		CSphereEntity *body = new CSphereEntity(m_pColorLightObject, GetBodyRadius(), GetSlice(), GetSlice());
		body->Create();			
		CVector3 vBackBody = m_listBody.back()->GetPosition();
		CVector3 vSrcTail = m_pTail->GetPosition();
		body->SetPosition(vSrcTail);
		m_listBody.push_back(body);
		m_pTail->SetPosition(vBackBody + 1.5f * (vSrcTail - vBackBody));

		ISceneNode *pRootNode = SCENEMGR->GetCurrentScene()->GetRootNode();
		pRootNode->AddChild(body);
	}
}
Beispiel #2
0
void CPlayer::Create()
{
	m_pHead->Create();
	ISceneNode *pRootNode = SCENEMGR->GetCurrentScene()->GetRootNode();
	pRootNode->AddChild(m_pHead);
	
}
Beispiel #3
0
CNPC::CNPC(float color[4], float radius)
{
	m_pColorLightObject = new CColorPointLightObject(color);
	m_pBody = new CSphereEntity(m_pColorLightObject, radius, 50, 25);
	m_pBody->Create();

	ISceneNode *pRootNode = SCENEMGR->GetCurrentScene()->GetRootNode();
	pRootNode->AddChild(m_pBody);
}