virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch (event) { case eFE_Activate: { if (pActInfo->pEntity == 0) return; CPlayer* pPlayer = GetPlayer(pActInfo->pEntity->GetId()); if (pPlayer == 0) return; int8 newState = -1; if(IsPortActive(pActInfo, EIP_Open)) newState = 2; else if(IsPortActive(pActInfo, EIP_Close)) newState = 1; else if(IsPortActive(pActInfo, EIP_Remove)) { newState = 0; pPlayer->EnableParachute(false); } if (newState != -1) pPlayer->ChangeParachuteState(newState); if (IsPortActive(pActInfo, EIP_FreeFall)) pPlayer->ForceFreeFall(); } break; } }
//------------------------------------------------------------------------ //------------------------------------------------------------------------ void CPlayerFeature::Parachute(CActor *pActor) { if (pActor && pActor->GetActorClass() == CPlayer::GetActorClassType()) { CPlayer *pPlayer = static_cast<CPlayer *>(pActor); pPlayer->EnableParachute(true); } }