Component * SwitchComponent::Clone(SceneNode * toEntity)
{
	SwitchComponent * newComponent = new SwitchComponent();
	newComponent->SetEntity(toEntity);
	GlobalEventSystem::Instance()->Event(toEntity, this, EventSystem::SWITCH_CHANGED);
	return newComponent;
}
예제 #2
0
void RenderUpdateSystem::UpdateActiveIndexes(Entity *entity, RenderObject *object)
{
    Entity *parent;
    
    // search effective lod index
    parent = entity;
    while(NULL != parent)
    {
        LodComponent *lc = GetLodComponent(parent);
        if(NULL != lc)
        {
            object->SetLodIndex(lc->currentLod);
            break;
        }

        parent = parent->GetParent();
    }

    // search effective switch index
    parent = entity;
    while(NULL != parent)
    {
        SwitchComponent *sc = GetSwitchComponent(parent);
        if(NULL != sc)
        {
            object->SetSwitchIndex(sc->GetSwitchIndex());
            break;
        }

        parent = parent->GetParent();
    }
}
void SetSwitchIndexHelper::ProcessSwitchIndexUpdate(uint32 value, eSET_SWITCH_INDEX state)
{
	for(int i = 0; i < SceneDataManager::Instance()->SceneCount(); ++i)
	{
		SceneData *sceneData = SceneDataManager::Instance()->SceneGet(i);
		
		List<SceneNode*> switchComponents;
		if( SetSwitchIndexHelper::FOR_SELECTED == state)
		{
			SceneNode *selectedNode = SceneDataManager::Instance()->SceneGetSelectedNode(sceneData);
			if(NULL != selectedNode)
			{
				selectedNode->FindAllSwitchComponentsRecursive(switchComponents);
			}
		}
		if( SetSwitchIndexHelper::FOR_SCENE == state)
		{
			sceneData->GetScene()->FindAllSwitchComponentsRecursive( switchComponents);
		}
		
		for(List<SceneNode*>::const_iterator it = switchComponents.begin(); it != switchComponents.end(); ++it)
		{
			
			SwitchComponent * switchComponent = cast_if_equal<SwitchComponent*>((*it)->GetComponent(Component::SWITCH_COMPONENT));
			if(NULL != switchComponent)
			{
				uint32 rangeSize = switchComponent->GetEntity()->GetChildrenCount();
				switchComponent->SetSwitchIndex(value);
			}
		}
	}
}
예제 #4
0
Component * SwitchComponent::Clone(Entity * toEntity)
{
    SwitchComponent * newComponent = new SwitchComponent();
    newComponent->SetEntity(toEntity);
    newComponent->SetSwitchIndex(GetSwitchIndex());

    return newComponent;
}