IEntity *CLiveBonusType::CreateInstance(IEntity *piParent,unsigned int dwCurrentTime)
{
	CLiveBonus *piEntity=new CLiveBonus(this);
	SPhysicInfo *pPhysicInfo=piEntity->GetPhysicInfo();
	InitializeEntity(piEntity,dwCurrentTime);
	
	// Se posiciona el bonus en el plano aereo, en el juego no hay bonus de armas entregados por unidades
	// de tierra, pero just in case
	CVector vPosition=pPhysicInfo->vPosition=piParent?piParent->GetPhysicInfo()->vPosition:Origin;
	CVector vStart,vEnd;
	CVector vCameraPos;
	if(m_PlayAreaManager.m_piPlayAreaManager)
	{
		m_PlayAreaManager.m_piPlayAreaManager->GetCameraRoute(&vStart,&vEnd);
		IGenericCamera *piCamera=m_PlayAreaManager.m_piPlayAreaManager->GetCamera();
		if(piCamera){vCameraPos=piCamera->GetPosition();}
		REL(piCamera);	
	}
	CPlane playAreaPlane=CPlane(AxisPosY,vStart);
	CVector vCut;
	if(playAreaPlane.Cut(vPosition,vCameraPos,&vCut))
	{
		pPhysicInfo->vPosition=vCut;
	}
	
	piEntity->SetState(eLiveBonusState_Normal,ANIMATION_RANDOM);
	piEntity->SetInitialVelocity();
	return piEntity;
}
IEntity *CBombBonusType::CreateInstance(IEntity *piOwner,unsigned int dwCurrentTime)
{
	CBombBonus *piEntity=new CBombBonus(this,piOwner);
	InitializeEntity(piEntity,dwCurrentTime);
  
	piEntity->SetState(eBombBonusState_Normal,ANIMATION_RANDOM);
	return piEntity;
}
IEntity *CBombProjectileType::CreateInstance(IEntity *piParent,unsigned int dwCurrentTime)
{
  CBombProjectile *piEntity=new CBombProjectile(this,piParent);
  InitializeEntity(piEntity,dwCurrentTime);
  piEntity->SetAlignment(piParent->GetAlignment());
  piEntity->SetState(eBombState_Normal);
  return piEntity;
}
Exemple #4
0
/**
 * Retrieves an entity from the unused list or allocates one if the list is empty
 * @return A new, initialized entity
 */
Entity_T *NewEntity()
{
	Entity_T *ent;
	if(gUnusedEntityList == NULL)
		ent = (Entity_T *)malloc(sizeof(Entity_T));
	else{
		ent = gUnusedEntityList;
		gUnusedEntityList = gUnusedEntityList->next;
	}
	//Initialize it before sending it out
	InitializeEntity(ent);
	ent->next = NULL;
	ent->nextLight = NULL;

	return ent;
}
void WSL::Framework::Standard::Base::Entity::Construct( int obj_ID, bool Refresh, bool Destroy, bool initialize_, bool RDestroy,
						std::string refesh_Script, std::string initialize_Script, std::string destroy_Script,
						std::string other_Script, WSL::Engine *refrence_ )
{
	onLuaStack = false;
	refrence.push_back( refrence_ );
	objID = obj_ID;
	componentID = 0;
	refresh = Refresh;
	destroy = Destroy;
	initialize = initialize_;
	runDestroyScript = RDestroy;
	refreshScript = refesh_Script;
	initializeScript = initialize_Script;
	destroyScript = destroy_Script;
	otherScript = other_Script;
	InitializeEntity( objID );
}
IEntity *CStaticStructureType::CreateInstance(IEntity *piParent,unsigned int dwCurrentTime)
{
	CStaticStructure *piEntity=new CStaticStructure(this,dwCurrentTime);
	InitializeEntity(piEntity,dwCurrentTime);
	return piEntity;
}