virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch(event) { case eFE_Update: { } break; case eFE_Activate: { if(IsPortActive(pActInfo, EIP_Get)) { gEnv->pGame->GetIGameFramework()->RegisterListener(this, "FlowMouseEntitiesInBox", FRAMEWORKLISTENERPRIORITY_DEFAULT); m_get = true; m_actInfo = *pActInfo; m_screenX = GetPortInt(pActInfo, EIP_ScreenX); m_screenY = GetPortInt(pActInfo, EIP_ScreenY); m_screenX2 = GetPortInt(pActInfo, EIP_ScreenX2); m_screenY2 = GetPortInt(pActInfo, EIP_ScreenY2); } break; } } }
void CFlashUIEventNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { switch (event) { case eFE_Initialize: { pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true); m_events.clear(); m_events.init( pActInfo->pGraph ); ClearListener(); m_iCurrInstanceId = GetPortInt(pActInfo, eI_InstanceID); if (m_iCurrInstanceId < -1) m_iCurrInstanceId = -1; SPerInstanceCall0 caller; caller.Execute(m_pElement, m_iCurrInstanceId, functor(*this, &CFlashUIEventNode::RegisterAsListener)); } break; case eFE_Activate: if (IsPortActive( pActInfo, eI_InstanceID )) { m_iCurrInstanceId = GetPortInt(pActInfo, eI_InstanceID); if (m_iCurrInstanceId < -1) m_iCurrInstanceId = -1; ClearListener(); SPerInstanceCall0 caller; caller.Execute(m_pElement, m_iCurrInstanceId, functor(*this, &CFlashUIEventNode::RegisterAsListener)); } break; case eFE_Update: FlushNextEvent( pActInfo ); break; } }
// ~IInputEventListener virtual bool OnInputEvent( const SInputEvent &event ) { if (true == m_bActive) { #if defined(ORBIS) // FIXME: Using PS3 inputs for ORBIS int nThisKey = event.keyId; int nKey = -1; int nInput = GetPortInt(&m_actInfo, EIP_Key); int tableSize = sizeof(PS3KeyTable)/sizeof(PS3KeyTable[0]); if ( nInput>=0 && nInput<tableSize ) nKey = PS3KeyTable[nInput]; #else // Translate key, check value const int nThisKey = TranslateKey(event.keyId); const int nKey = GetPortInt(&m_actInfo, EIP_Key); #endif if (nKey == nThisKey) { // Return based on state if (eIS_Pressed == event.state) ActivateOutput(&m_actInfo, EOP_Pressed, true); else if (eIS_Released == event.state) ActivateOutput(&m_actInfo, EOP_Released, true); } } // Let other listeners handle it return false; }
virtual void Serialize(SActivationInfo *pActInfo, TSerialize ser) { ser.BeginGroup("Local"); ser.Value("Active", m_bActive); if (m_bActive) { ser.Value("position", m_position); ser.Value("destination", m_destination); ser.Value("startPos", m_startPos); ser.Value("lastFrameTime", m_lastFrameTime); ser.Value("topSpeed", m_topSpeed); ser.Value("easeInDistance", m_easeInDistance); ser.Value("easeOutDistance", m_easeOutDistance); ser.Value("stopping", m_stopping); ser.Value("startTime", m_startTime); ser.Value("bForceFinishAsTooNear", m_bForceFinishAsTooNear); } ser.EndGroup(); if (ser.IsReading()) { m_coorSys = (ECoordSys)GetPortInt( pActInfo, IN_COORDSYS ); m_valueType = (EValueType)GetPortInt(pActInfo, IN_VALUETYPE); } }
//---------------------------------------------------------------------- void ReadCurrentInputParams( SActivationInfo* pActInfo, SInputParams &inputParams ) { int presetIndex = GetPortInt( pActInfo, EIP_Preset ); if (presetIndex > 0 && presetIndex <= NUM_PRESETS) { inputParams = m_Presets[presetIndex - 1]; inputParams.angle = Ang3(DEG2RAD(m_Presets[presetIndex - 1].angle)); } else { inputParams.groundOnly = GetPortBool(pActInfo, EIP_GroundOnly); inputParams.isSmooth = GetPortBool(pActInfo, EIP_Smooth); inputParams.restriction = eRestriction( GetPortInt(pActInfo, EIP_Restriction)); inputParams.view = eViewType( GetPortInt(pActInfo, EIP_ViewType)); inputParams.angle = Ang3(DEG2RAD(GetPortVec3(pActInfo, EIP_Angle))); inputParams.shift = GetPortVec3(pActInfo, EIP_Shift); inputParams.frequency = GetPortFloat(pActInfo, EIP_Frequency); inputParams.randomness = GetPortFloat(pActInfo, EIP_Randomness); inputParams.distance = GetPortFloat(pActInfo, EIP_Distance); inputParams.rangeMin = GetPortFloat(pActInfo, EIP_RangeMin); inputParams.rangeMax = GetPortFloat(pActInfo, EIP_RangeMax); inputParams.sustainDuration = GetPortFloat(pActInfo, EIP_SustainDuration); inputParams.fadeInDuration = GetPortFloat(pActInfo, EIP_FadeInDuration); inputParams.fadeOutDuration = GetPortFloat(pActInfo, EIP_FadeOutDuration); } }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo ) { switch (event) { case eFE_Initialize: case eFE_Activate: if (IsPortActive(pActInfo, 0)) { int minOut = GetPortInt(pActInfo,1); int maxOut = GetPortInt(pActInfo,2); minOut = CLAMP(minOut, 0, NUM_OUTPUTS); maxOut = CLAMP(maxOut, 0, NUM_OUTPUTS); if (maxOut < minOut) std::swap(minOut, maxOut); int n = cry_random(minOut, maxOut); // Collect the outputs to use static int out[NUM_OUTPUTS]; for (unsigned i = 0; i < NUM_OUTPUTS; i++) out[i] = -1; int nout = 0; for (int i = 0; i < NUM_OUTPUTS; i++) { if (IsOutputConnected(pActInfo, i)) { out[nout] = i; nout++; } } if (n > nout) n = nout; // Shuffle for (int i = 0; i < n; i++) std::swap(out[i], out[cry_random(0, nout - 1)]); // Set outputs. for (int i = 0; i < n; i++) { if (out[i] == -1) continue; ActivateOutput(pActInfo,out[i],GetPortAny(pActInfo, 0)); } } break; } }
virtual bool Execute(SActivationInfo *pActInfo) { bool bResult = false; SXmlDocument *doc; if (GDM->GetXmlDocument(pActInfo->pGraph, &doc) && doc->active) { const char* childName = GetPortString(pActInfo, EIP_Name); const int childIndex = GetPortInt(pActInfo, EIP_Index); const int childCount = doc->active->getChildCount(); XmlNodeRef ref = NULL; for (int i = 0, realCount = 0; i < childCount; ++i) { ref = doc->active->getChild(i); if (ref && strcmp(ref->getTag(), childName) == 0) { if (++realCount >= childIndex) { doc->active->deleteChildAt(i); bResult = true; break; } } } } return bResult; }
void CFlashUIWorldScreenPosNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { if ( event == eFE_Initialize ) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } else if ( event == eFE_Activate ) { if ( IsPortActive( pActInfo, eI_UIElement ) ) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } if ( IsPortActive( pActInfo, eI_Get ) ) { const int instanceId = GetPortInt(pActInfo, eI_InstanceID); Vec3 worldPos = GetPortVec3(pActInfo, eI_WorldPos); Vec3 offset = GetPortVec3(pActInfo, eI_Offset); const bool scaleMode = GetPortBool(pActInfo, eI_ScaleMode); SPerInstanceCall3< Vec3&, Vec3&, bool > caller; if ( !caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIWorldScreenPosNode::GetScreenPosFromWorld), worldPos, offset, scaleMode, false) ) { UIACTION_WARNING( "FG: UIElement \"%s\" called get screenpos for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str(), instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) ); } ActivateOutput( pActInfo, eO_ScreenPos, worldPos); ActivateOutput( pActInfo, eO_Scale, offset.z); ActivateOutput( pActInfo, eO_IsOnScreen, offset.x == 0 && offset.y == 0); offset.z = 0; ActivateOutput( pActInfo, eO_OverScanBorder, offset); ActivateOutput( pActInfo, eO_OnGet, true ); } } }
void CFlashUIScreenPosNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { if ( event == eFE_Initialize ) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } else if ( event == eFE_Activate ) { if ( IsPortActive( pActInfo, eI_UIElement ) ) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } if ( IsPortActive( pActInfo, eI_Get ) ) { const int instanceId = GetPortInt(pActInfo, eI_InstanceID); float px = GetPortFloat(pActInfo, eI_PX); float py = GetPortFloat(pActInfo, eI_PY); const bool scaleMode = GetPortBool(pActInfo, eI_ScaleMode); SPerInstanceCall3< float&, float&, bool > caller; if ( !caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIScreenPosNode::GetScreenPos), px, py, scaleMode, false) ) { UIACTION_WARNING( "FG: UIElement \"%s\" called get screenpos for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str(), instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) ); } ActivateOutput( pActInfo, eO_OnGet, true ); ActivateOutput(pActInfo, eO_PX, px); ActivateOutput(pActInfo, eO_PY, py); } } }
void CFlashUIAdvanceNode::ProcessEvent( EFlowEvent event,SActivationInfo *pActInfo ) { if ( event == eFE_Initialize ) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } else if ( event == eFE_Activate ) { if ( IsPortActive( pActInfo, eI_UIElement ) ) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } if ( IsPortActive( pActInfo, eI_Advance ) ) { const float delta = GetPortFloat(pActInfo, eI_Delta); const int instanceId = GetPortInt( pActInfo, eI_InstanceID ); SPerInstanceCall1<float> caller1; caller1.Execute( GetElement(), instanceId, functor(*this, &CFlashUIAdvanceNode::Advance), delta); ActivateOutput( pActInfo, eO_OnAdvance, true ); } } }
void CFlowNode_PrefabEventSource::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { ICustomEventManager* pCustomEventManager = gEnv->pGame->GetIGameFramework()->GetICustomEventManager(); CRY_ASSERT( pCustomEventManager != NULL ); if ( event == eFE_Activate ) { if ( IsPortActive( pActInfo, EIP_FireEvent) ) { if ( m_eventId != CUSTOMEVENTID_INVALID ) { pCustomEventManager->FireEvent( m_eventId ); } // Output port is activated from event } } else if (event == eFE_Initialize) { m_actInfo = *pActInfo; const TCustomEventId eventId = (TCustomEventId)GetPortInt( pActInfo, EIP_EventId ); if ( eventId != CUSTOMEVENTID_INVALID ) { pCustomEventManager->RegisterEventListener( this, eventId ); } m_eventId = eventId; } }
void CFlashUIFunctionNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { if (event == eFE_Activate && IsPortActive(pActInfo, eI_Call)) { int port = GetDynStartPort(); SUIArguments args; for (TUIParams::const_iterator iter = m_funcDesc.InputParams.Params.begin(); iter != m_funcDesc.InputParams.Params.end(); ++iter) { GetDynInput( args, *iter, pActInfo, port++ ); } TUIData res; const int instanceId = GetPortInt( pActInfo, eI_InstanceID ); if (IsTemplate() && !UpdateTmplDesc( GetPortString(pActInfo, eI_TemplateInstanceName), pActInfo )) return; SPerInstanceCall2< const SUIArguments &, TUIData & > caller; caller.Execute(m_pElement, instanceId, functor(*this, &CFlashUIFunctionNode::CallFunction), args, res); string out; res.GetValueWithConversion( out ); ActivateOutput( pActInfo, eO_RetVal, out ); ActivateOutput( pActInfo, eO_OnCall, true ); } }
void CFlashUIMCTemplateRemoveNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { if (event == eFE_Initialize) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } else if (event == eFE_Activate) { if (IsPortActive( pActInfo, eI_UIElement )) { UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); } if (!UpdateTmplDesc( GetPortString( pActInfo, eI_TemplateInstanceName ), pActInfo )) return; if (GetElement() && IsPortActive(pActInfo, eI_Remove)) { const int instanceId = GetPortInt( pActInfo, eI_InstanceID ); SPerInstanceCall1< const SUIMovieClipDesc* > caller; caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIMCTemplateRemoveNode::RemoveMoviclip), GetTmplDesc(true), false); ActivateOutput( pActInfo, eO_OnRemove, true ); } } }
Assignment DefendAreaAssignmentFlowNode::SpecifyAssignment( SActivationInfo* pActInfo ) { SmartScriptTable data(gEnv->pScriptSystem); data->SetValue("position", GetPortVec3(pActInfo, InputPort_Position)); data->SetValue("radius", GetPortInt(pActInfo, InputPort_Radius)); return Assignment(Assignment::DefendArea, data); }
// --------------------------------------------------------------- void CFlashUIBaseNodeDynPorts::GetDynInput( SUIArguments &args, const SUIParameterDesc &desc, SActivationInfo* pActInfo, int port) { switch (desc.eType) { case SUIParameterDesc::eUIPT_Bool: args.AddArgument( GetPortBool(pActInfo, port)); break; case SUIParameterDesc::eUIPT_Int: args.AddArgument( GetPortInt(pActInfo, port)); break; case SUIParameterDesc::eUIPT_Float: args.AddArgument( GetPortFloat(pActInfo, port)); break; case SUIParameterDesc::eUIPT_String: args.AddArgument( GetPortString(pActInfo, port)); break; case SUIParameterDesc::eUIPT_WString: args.AddArgument( GetPortString(pActInfo, port), eUIDT_WString ); break; case SUIParameterDesc::eUIPT_Vec3: args.AddArgument( GetPortVec3(pActInfo, port)); break; default: { string val; const TFlowInputData data = GetPortAny(pActInfo, port); data.GetValueWithConversion(val); args.AddArgument(val, eUIDT_Any); } break; } }
void CSetEquipmentLoadoutNode ::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { if(event == eFE_Activate && IsPortActive(pActInfo, 0)) { if(pActInfo->pEntity) { IActor* pActor = GetInputActor( pActInfo ); CGameRules *pGameRules = g_pGame->GetGameRules(); if(pActor) { int packIndex = GetPortInt(pActInfo, eI_EquipLoadout); CEquipmentLoadout *pEquipmentLoadout = g_pGame->GetEquipmentLoadout(); if(pEquipmentLoadout) { pEquipmentLoadout->SetSelectedPackage(packIndex); pGameRules->SetPendingLoadoutChange(); } } } } }
void CFlashUIElementInstanceNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { switch (event) { case eFE_Initialize: pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true); m_events.clear(); m_events.init( pActInfo->pGraph ); if (GetElement()) GetElement()->RemoveEventListener(this); UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); if (GetElement()) GetElement()->AddEventListener(this, "CFlashUIElementInstanceNode"); break; case eFE_Activate: if (IsPortActive( pActInfo, eI_InstanceID ) || IsPortActive( pActInfo, eI_UIElement )) { if (GetElement()) GetElement()->RemoveEventListener(this); UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo ); if (GetElement()) GetElement()->AddEventListener(this, "CFlashUIElementInstanceNode"); } if (IsPortActive( pActInfo, eI_DestroyInstance )) { const int instanceId = GetPortInt(pActInfo, eI_InstanceID); SPerInstanceCall0 caller; caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIElementInstanceNode::DestroyInstance)); } break; case eFE_Update: FlushNextEvent(pActInfo); break; } }
virtual void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo) { switch (event) { case eFE_Initialize: { break; } case eFE_Activate: { const string& variableName = GetPortString(pActInfo, eIn_VariableName); if (variableName.empty()) { CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "CAction:DRS_SetVariable: Cannot be executed without a Variable Name."); return; } const string& collectionName = GetPortString(pActInfo, eIn_VariableCollectionName); EntityId entityID = GetPortEntityId(pActInfo, eIn_EntityID); DRS::IVariableCollection* variableCollection = GetVariableCollection(entityID, collectionName); if (variableCollection) { int newVariableValue = GetPortInt(pActInfo, eIn_IntegerValue); variableCollection->SetVariableValue(variableName, newVariableValue, true, GetPortFloat(pActInfo, eIn_ResetTime)); ActivateOutput(pActInfo, eOut_VariableCollectionName, variableCollection->GetName().GetText()); } break; } } }
void StoreRayType() { int ray_type = GetPortInt(&m_actInfo, EIP_RayType); switch(ray_type) { case 0: m_rayTypeFilter = ent_all; break; case 1: m_rayTypeFilter = ent_terrain; break; case 2: m_rayTypeFilter = ent_rigid; break; case 3: m_rayTypeFilter = ent_static; break; case 4: m_rayTypeFilter = ent_water; break; case 5: m_rayTypeFilter = ent_living; break; } }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo ) { switch (event) { case eFE_Activate: if (IsPortActive(pActInfo,IN_SEND)) { const string & key = GetPortString(pActInfo,IN_MSG); const string & value = GetPortString(pActInfo,IN_VALUE); const int iTarget = GetPortInt(pActInfo,IN_TARGET); SNetMsgData::ETarget target = SNetMsgData::ConvertTargetIntToEnum(iTarget); CRY_ASSERT_MESSAGE(target != SNetMsgData::eT_Invalid, "CFlowNode_MsgSender: IN_TARGET input got converted to an invalid Enum"); if (target != SNetMsgData::eT_Invalid) { if (CNetMessageDistpatcher* pNetMsgDispatcher = CCryAction::GetCryAction()->GetNetMessageDispatcher()) { NET_MSG_DISPATCHER_LOG("CFlowNode_MsgSender: %s Send message [%s/%s]", CNetMessageDistpatcher::DbgTranslateLocationToString(), key.c_str(), value.c_str()); pNetMsgDispatcher->SendMessage(SNetMsgData(CNetMessageDistpatcher::GetLocation(), target, key, value)); ActivateOutput(pActInfo, OUT_DONE, true); return; } } ActivateOutput(pActInfo, OUT_ERROR, true); } break; } }
void UpdateOutputs( int alertnessGlobal ) { EFilterAI filterAI = (EFilterAI)(GetPortInt( &m_actInfo, IN_FILTERAI )); int alertness = 0; switch (filterAI) { case FAI_ALL: alertness = alertnessGlobal; break; case FAI_ENEMIES: alertness = g_pGame->GetGameAISystem()->GetAICounters().GetAlertnessCounter().GetAlertnessEnemies(); break; case FAI_FRIENDS: alertness = g_pGame->GetGameAISystem()->GetAICounters().GetAlertnessCounter().GetAlertnessFriends(); break; case FAI_FACTION: { if (m_faction!=IFactionMap::InvalidFactionID) { alertness = g_pGame->GetGameAISystem()->GetAICounters().GetAlertnessCounter().GetAlertnessFaction( m_faction ); } break; } } ActivateOutput( &m_actInfo, OUT_ALERTNESS, alertness ); uint32 colorPort = clamp_tpl( alertness+OUT_GREEN, (int)OUT_GREEN, (int)OUT_RED ); ActivateOutput( &m_actInfo, colorPort, true ); }
void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch (event) { case eFE_Initialize: { m_actInfo = *pActInfo; } break; case eFE_Activate: { if(!pActInfo || !pActInfo->pEntity) break; if(IsPortActive(pActInfo, EIP_Trigger)) { string teamName = GetPortString(pActInfo, EIP_TeamName); int team = GetPortInt(pActInfo, EIP_TeamId); if(team == 0) { if(!strcmp(teamName, "tan")) team = 1; else if(!strcmp(teamName, "black")) team = 2; } g_pGame->GetGameRules()->SetTeam(team, pActInfo->pEntity->GetId()); } } break; } }
virtual void OnIterStart(SActivationInfo *pActInfo) { const int type = GetPortInt(pActInfo, EIP_Type); IEntitySystem *pEntitySystem = gEnv->pEntitySystem; if (pEntitySystem) { IEntityItPtr iter = pEntitySystem->GetEntityIterator(); if (iter) { iter->MoveFirst(); IEntity *pEntity = NULL; while (!iter->IsEnd()) { pEntity = iter->Next(); if (pEntity) { const EntityId id = pEntity->GetId(); const EEntityType entityType = GetEntityType(id); if (IsValidType(type, entityType)) { AddEntity(id); } } } } } }
bool SendNext(SActivationInfo *pActInfo) { bool bResult = false; if (m_Count > 0) { if (m_Iter < m_Count) { const int limit = GetPortInt(pActInfo, EIP_Limit); if (limit == 0 || m_Iter <= limit) { OnIterNext(pActInfo); EntityId id = *m_ListIter; ActivateOutput(pActInfo, EOP_EntityId, id); ActivateOutput(pActInfo, EOP_Count, m_Iter); ++m_Iter; ++m_ListIter; bResult = true; } } } if (!bResult) { ActivateOutput(pActInfo, EOP_Done, m_Iter); } return bResult; }
virtual void OnHUDEvent(const SHUDEvent& event) { int eventID = GetPortInt(&m_pActInfo, 0); if(event.eventType == eventID) { ActivateOutput(&m_pActInfo, eOP_EventFired, 1); for(unsigned int i = 0; i < event.GetDataSize(); i++) { switch(event.GetData(i).m_type) { case SHUDEventData::eSEDT_voidptr: break; case SHUDEventData::eSEDT_bool: break; case SHUDEventData::eSEDT_int: break; case SHUDEventData::eSEDT_float: { if(eventID == eHUDEvent_LeavingBattleArea) { float fDeathTimer = event.GetData(i).GetFloat(); ActivateOutput(&m_pActInfo, eOP_DeathTimer, fDeathTimer); } } break; case SHUDEventData::eSEDT_undef: default: CryWarning(VALIDATOR_MODULE_FLOWGRAPH, VALIDATOR_WARNING, "[CFlowNode_BattleAreaListener] HudEvent data unknown."); break; } } } }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch (event) { case eFE_Initialize: { bool bPaused = GetPortBool(pActInfo,IN_PAUSED); pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused ); m_last = gEnv->pTimer->GetFrameStartTime(); } break; case eFE_Update: { if (GetPortBool(pActInfo,IN_PAUSED)) return; float fPeriod = GetPortFloat(pActInfo,IN_PERIOD); CTimeValue time = gEnv->pTimer->GetFrameStartTime(); CTimeValue dt = time - m_last; if (dt.GetSeconds() >= fPeriod) { m_last = time; int nMin = GetPortInt(pActInfo,IN_MIN); int nMax = GetPortInt(pActInfo,IN_MAX); m_nCurrentCount++; if (m_nCurrentCount < nMin) m_nCurrentCount = nMin; if (m_nCurrentCount > nMax) { m_nCurrentCount = nMin; } ActivateOutput( pActInfo,OUT_OUT,m_nCurrentCount ); } } break; case eFE_Activate: { if (IsPortActive(pActInfo,IN_PAUSED)) { bool bPaused = GetPortBool(pActInfo,IN_PAUSED); pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused ); } } break; } }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch (event) { case eFE_Activate: const int nDrawPlayer = GetPortInt(pActInfo, EIP_DrawPlayer); if (IsPortActive(pActInfo, EIP_Link)) { IEntity* pEntity = gEnv->pEntitySystem->GetEntity(GetPortEntityId(pActInfo, EIP_Target)); if (pEntity) { CActor *pPlayerActor = static_cast<CActor*>(gEnv->pGame->GetIGameFramework()->GetClientActor()); if (pPlayerActor) { SActorStats* pActorStats = pPlayerActor->GetActorStats(); if (pActorStats) { if (nDrawPlayer == -1) pActorStats->isHidden = true; else if (nDrawPlayer == 1) pActorStats->isHidden = false; } m_Position = pEntity->GetWorldPos(); m_Rotation = pEntity->GetWorldRotation(); pPlayerActor->LinkToEntity(pEntity->GetId()); ActivateOutput(pActInfo, EOP_Linked, true); } } } if (IsPortActive(pActInfo, EIP_Unlink)) { CActor *pPlayerActor = static_cast<CActor*>(gEnv->pGame->GetIGameFramework()->GetClientActor()); if (pPlayerActor) { SActorStats* pActorStats = pPlayerActor->GetActorStats(); if (pActorStats) { if (nDrawPlayer == -1) pActorStats->isHidden = true; else if (nDrawPlayer == 1) pActorStats->isHidden = false; } bool keepTransform = GetPortBool(pActInfo, EIP_KeepTransform); pPlayerActor->LinkToEntity(0, keepTransform); if(!keepTransform) { pPlayerActor->GetEntity()->SetPos(m_Position); pPlayerActor->GetEntity()->SetRotation(m_Rotation); } ActivateOutput(pActInfo, EOP_Unlinked, true); } } break; } }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo ) { if ( event == eFE_Initialize ) { m_actInfo = *pActInfo; active = GetPortBool( pActInfo, 0 ); pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true ); } if ( event == eFE_Activate ) { active = GetPortBool( pActInfo, 0 ); } if ( event == eFE_Update && active ) { int w_id = GetPortInt( pActInfo, 1 ); if ( w_id < 0 || w_id >= CryVR_WiimoteManagerPlugin::found ) { return ; } int i = 0; wiimote** manettes = CryVR_WiimoteManagerPlugin::GetWiimotes(); //Optimisation v0.1 wiimote_move = false; nunchuk_move = false; while ( wiiuse_poll( manettes, CryVR_WiimoteManagerPlugin::found ) && i < GetPortInt( pActInfo, 2 ) ) { if ( CryVR_WiimoteManagerPlugin::GetWiimotes( w_id )->event == WIIUSE_EVENT ) { i++; handle_event( CryVR_WiimoteManagerPlugin::GetWiimotes( w_id ) ); } else if ( CryVR_WiimoteManagerPlugin::GetWiimotes( w_id )->event == WIIUSE_NUNCHUK_INSERTED || CryVR_WiimoteManagerPlugin::GetWiimotes( w_id )->event == WIIUSE_NUNCHUK_REMOVED ) { CryVR_WiimoteManagerPlugin::Status( w_id ); } //Recherche d'optimisation. if ( nunchuk_move && wiimote_move && GetPortBool( pActInfo, 3 ) ) { return ; } } } }
Assignment HoldPositionAssignmentFlowNode::SpecifyAssignment( SActivationInfo* pActInfo ) { SmartScriptTable data(gEnv->pScriptSystem); data->SetValue("position", GetPortVec3(pActInfo, InputPort_Position)); data->SetValue("radius", GetPortInt(pActInfo, InputPort_Radius)); data->SetValue("direction", GetPortVec3(pActInfo, InputPort_Direction)); data->SetValue("useCover", GetPortBool(pActInfo, InputPort_UseCover)); return Assignment(Assignment::HoldPosition, data); }
void CFlashUIMCTemplateCreateNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { if (event == eFE_Initialize) { m_TmplDescHelper.UpdateObjectDesc( GetPortString( pActInfo, eI_UIMovieClipTmpl ), pActInfo, true ); m_ParentDescHelper.UpdateObjectDesc( GetPortString( pActInfo, eI_UIParentMovieClip ), pActInfo, false ); if (GetParentDesc() && m_TmplDescHelper.GetElement() != m_ParentDescHelper.GetElement()) { UIACTION_WARNING( "FG: Can't attach \"%s\" on parent MC \"%s\" (they must be part of the same UIElement!), referenced at node \"%s\"", GetPortString( pActInfo, eI_UIMovieClipTmpl ).c_str(), GetPortString( pActInfo, eI_UIParentMovieClip ).c_str(), pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); m_ParentDescHelper.Reset(); } } else if (event == eFE_Activate) { if (IsPortActive( pActInfo, eI_UIMovieClipTmpl )) { m_TmplDescHelper.UpdateObjectDesc( GetPortString( pActInfo, eI_UIMovieClipTmpl ), pActInfo, true ); } IUIElement* pElement = GetElement(); if (IsPortActive( pActInfo, eI_UIParentMovieClip )) { m_ParentDescHelper.UpdateObjectDesc( GetPortString( pActInfo, eI_UIParentMovieClip ), pActInfo, false ); if (GetParentDesc() && m_TmplDescHelper.GetElement() != m_ParentDescHelper.GetElement()) { UIACTION_WARNING( "FG: Can't attach \"%s\" on parent MC \"%s\" (they must be part of the same UIElement!), referenced at node \"%s\"", GetPortString( pActInfo, eI_UIMovieClipTmpl ).c_str(), GetPortString( pActInfo, eI_UIParentMovieClip ).c_str(), pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); m_ParentDescHelper.Reset(); } } // if m_pCurrentParen was null we also allow to pass a template name! if (GetParentDesc() == NULL) { if (!m_ParentDescHelper.UpdateTmplDesc( GetPortString( pActInfo, eI_UIParentMovieClip ), pActInfo )) return; } if (GetElement() && IsPortActive(pActInfo, eI_Create)) { const int instanceId = GetPortInt( pActInfo, eI_InstanceID ); string name = GetPortString( pActInfo, eI_NewInstanceName ); SPerInstanceCall3< const SUIMovieClipDesc*, const SUIMovieClipDesc*, string & > caller; if (!caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIMCTemplateCreateNode::CreateMoviclip), GetTemplateDesc(), GetParentDesc(), name, false)) { UIACTION_WARNING( "FG: UIElement \"%s\" called get CreateMovieClip for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); } ActivateOutput( pActInfo, eO_InstanceName, name ); ActivateOutput( pActInfo, eO_OnCreate, true ); } } }