void WBCompEldFrobbable::SetHUDHidden(const bool Hidden) const { UIManager* const pUIManager = GetFramework()->GetUIManager(); ASSERT(pUIManager); STATIC_HASHED_STRING(HUD); STATIC_HASHED_STRING(FrobName); STATIC_HASHED_STRING(FrobVerb); STATIC_HASHED_STRING(FrobHold); { WB_MAKE_EVENT(SetWidgetHidden, GetEntity()); WB_SET_AUTO(SetWidgetHidden, Hash, Screen, sHUD); WB_SET_AUTO(SetWidgetHidden, Hash, Widget, sFrobName); WB_SET_AUTO(SetWidgetHidden, Bool, Hidden, Hidden); WB_DISPATCH_EVENT(GetEventManager(), SetWidgetHidden, pUIManager); } { WB_MAKE_EVENT(SetWidgetHidden, GetEntity()); WB_SET_AUTO(SetWidgetHidden, Hash, Screen, sHUD); WB_SET_AUTO(SetWidgetHidden, Hash, Widget, sFrobVerb); WB_SET_AUTO(SetWidgetHidden, Bool, Hidden, Hidden); WB_DISPATCH_EVENT(GetEventManager(), SetWidgetHidden, pUIManager); } { WB_MAKE_EVENT(SetWidgetHidden, GetEntity()); WB_SET_AUTO(SetWidgetHidden, Hash, Screen, sHUD); WB_SET_AUTO(SetWidgetHidden, Hash, Widget, sFrobHold); WB_SET_AUTO(SetWidgetHidden, Bool, Hidden, Hidden || !m_HoldReleaseMode); WB_DISPATCH_EVENT(GetEventManager(), SetWidgetHidden, pUIManager); } }
void WBCompEldEndgameCounter::SetHUDHidden( const bool Hidden ) const { UIManager* const pUIManager = GetFramework()->GetUIManager(); ASSERT( pUIManager ); STATIC_HASHED_STRING( HUD ); STATIC_HASHED_STRING( EndgameImg ); STATIC_HASHED_STRING( EndgameCounter ); { WB_MAKE_EVENT( SetWidgetHidden, GetEntity() ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sEndgameImg ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, Hidden ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetHidden, pUIManager ); } { WB_MAKE_EVENT( SetWidgetHidden, GetEntity() ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sEndgameCounter ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, Hidden ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetHidden, pUIManager ); } }
void WBCompEldHands::ShowWeaponAltHUD() const { WBEntity* const pWeapon = GetWeaponAlt(); ASSERT( pWeapon ); WBCompEldWeapon* const pWeaponComponent = GET_WBCOMP( pWeapon, EldWeapon ); ASSERT( pWeaponComponent ); STATIC_HASHED_STRING( HUD ); STATIC_HASHED_STRING( WeaponAltIcon ); { WB_MAKE_EVENT( SetWidgetImage, NULL ); WB_SET_AUTO( SetWidgetImage, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetImage, Hash, Widget, sWeaponAltIcon ); WB_SET_AUTO( SetWidgetImage, Hash, Image, pWeaponComponent->GetWeaponIcon() ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetImage, NULL ); } { WB_MAKE_EVENT( SetWidgetHidden, NULL ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sWeaponAltIcon ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, false ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetHidden, NULL ); } }
void WBCompEldPickup::GiveItemTo(WBEntity* const pEntity) const { // Because Pickup is now unfortunately doubling as a Purchaseable. // This is such a hack. // TODO: Make a separate Purchaseable component. if (m_GiveItemDef == "") { // OnObtained is fired whether purchased, stolen, or given WB_MAKE_EVENT(OnObtained, GetEntity()); WB_SET_AUTO(OnObtained, Entity, Buyer, pEntity); WB_DISPATCH_EVENT(GetEventManager(), OnObtained, GetEntity()); return; } DEVASSERT(pEntity); WBCompEldInventory* const pInventory = GET_WBCOMP(pEntity, EldInventory); ASSERT(pInventory); WBEntity* const pGivenEntity = WBWorld::GetInstance()->CreateEntity(m_GiveItemDef); ASSERT(pGivenEntity); pInventory->AddItem(pGivenEntity); WB_MAKE_EVENT(OnItemGiven, GetEntity()); WB_SET_AUTO(OnItemGiven, Entity, GivenTo, pEntity); WB_DISPATCH_EVENT(GetEventManager(), OnItemGiven, GetEntity()); GetEntity()->Destroy(); }
void WBCompEldHands::ShowHands() const { WB_MAKE_EVENT( Show, GetEntity() ); WB_DISPATCH_EVENT( GetEventManager(), Show, GetRightHand() ); WB_DISPATCH_EVENT( GetEventManager(), Show, GetLeftHand() ); WB_DISPATCH_EVENT( GetEventManager(), Show, GetItemInRightHand() ); WB_DISPATCH_EVENT( GetEventManager(), Show, GetItemInLeftHand() ); }
void WBCompEldHands::PlayAnimation( WBEntity* const pAnimatingEntity, const HashedString& AnimationName, const EHand Hand ) const { if( !pAnimatingEntity ) { return; } WB_MAKE_EVENT( PlayAnim, GetEntity() ); WB_SET_AUTO( PlayAnim, Hash, AnimationName, AnimationName ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), PlayAnim, pAnimatingEntity ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), PlayAnim, GetHand( Hand ) ); }
/*virtual*/ void WBCompEldHard::HandleEvent( const WBEvent& Event ) { XTRACE_FUNCTION; Super::HandleEvent( Event ); STATIC_HASHED_STRING( SetHard ); STATIC_HASHED_STRING( PushPersistence ); STATIC_HASHED_STRING( PullPersistence ); const HashedString EventName = Event.GetEventName(); if( EventName == sSetHard ) { m_Hard = true; // Broadcast event to everything with an EldHardListener component. WB_MAKE_EVENT( NotifyHardModeSet, NULL ); WB_DISPATCH_EVENT( GetEventManager(), NotifyHardModeSet, NULL ); } else if( EventName == sPushPersistence ) { PushPersistence(); } else if( EventName == sPullPersistence ) { PullPersistence(); } }
void WBCompEldWatson::TickActivated() { if( !EldritchGame::IsPlayerAlive() ) { // Player can't cause Watson to prime when dead return; } if( !EldritchGame::IsPlayerVisible() ) { // Player can't cause Watson to prime when invisible return; } // Don't check min distance, because we don't want to re-prime right after an attack. if( IsPlayerVulnerable( false ) ) { return; } // We're activated and the player has (probably) seen us. Primed for attack. m_Primed = true; WB_MAKE_EVENT( OnWatsonPrimed, GetEntity() ); WB_DISPATCH_EVENT( GetEventManager(), OnWatsonPrimed, GetEntity() ); }
void WBCompEldWallet::AddMoney(const uint Money, const bool ShowPickupScreen) { m_Money = Min(m_Money + Money, m_Limit); PublishToHUD(); if (ShowPickupScreen) { // Show the money pickup screen and hide it after some time STATICHASH(MoneyPickup); STATICHASH(Money); ConfigManager::SetInt(sMoney, Money, sMoneyPickup); STATIC_HASHED_STRING(MoneyPickupScreen); { WB_MAKE_EVENT(PushUIScreen, NULL); WB_SET_AUTO(PushUIScreen, Hash, Screen, sMoneyPickupScreen); WB_DISPATCH_EVENT(GetEventManager(), PushUIScreen, NULL); } { // Remove previously queued hide event if any GetEventManager()->UnqueueEvent(m_HidePickupScreenUID); WB_MAKE_EVENT(RemoveUIScreen, NULL); WB_SET_AUTO(RemoveUIScreen, Hash, Screen, sMoneyPickupScreen); m_HidePickupScreenUID = WB_QUEUE_EVENT_DELAY( GetEventManager(), RemoveUIScreen, NULL, m_HidePickupScreenDelay); } } }
void WBCompEldPickup::NotifyTheftBy(WBEntity* const pEntity) const { DEVASSERT(pEntity); { WB_MAKE_EVENT(OnTheft, GetEntity()); WB_SET_AUTO(OnTheft, Entity, Thief, pEntity); WB_DISPATCH_EVENT(GetEventManager(), OnTheft, GetEntity()); } { // OnObtained is fired whether purchased, stolen, or given WB_MAKE_EVENT(OnObtained, GetEntity()); WB_SET_AUTO(OnObtained, Entity, Buyer, pEntity); WB_DISPATCH_EVENT(GetEventManager(), OnObtained, GetEntity()); } }
void WBCompEldHUDMarker::UpdateMarkerPosition() const { WBEntity* const pEntity = GetEntity(); WBCompEldTransform* const pTransform = pEntity->GetTransformComponent<WBCompEldTransform>(); EldritchWorld* const pWorld = GetWorld(); const View* const pView = GetFramework()->GetMainView(); Vector Location = pTransform->GetLocation(); Location.z += m_OffsetZ; const Vector& ViewLocation = pView->m_Location; const Vector2 ScreenLocation = pView->ProjectAndClipToScreen( Location ); CollisionInfo Info; Info.m_CollideWorld = true; Info.m_CollideEntities = true; Info.m_CollidingEntity = pEntity; Info.m_UserFlags = EECF_Occlusion; Info.m_StopAtAnyCollision = true; const bool Occluded = pWorld->LineCheck( ViewLocation, Location, Info ); const float Distance = ( Location - ViewLocation ).Length(); const float Alpha = Occluded ? Attenuate( Distance, m_FalloffRadius ) : 1.0f; { WB_MAKE_EVENT( SetWidgetImage, NULL ); WB_SET_AUTO( SetWidgetImage, Hash, Screen, m_UIScreenName ); WB_SET_AUTO( SetWidgetImage, Hash, Widget, m_UIWidgetName ); WB_SET_AUTO( SetWidgetImage, Hash, Image, Occluded ? m_OccludedImage : m_UnoccludedImage ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetImage, NULL ); } { WB_MAKE_EVENT( SetWidgetLocation, NULL ); WB_SET_AUTO( SetWidgetLocation, Hash, Screen, m_UIScreenName ); WB_SET_AUTO( SetWidgetLocation, Hash, Widget, m_UIWidgetName ); WB_SET_AUTO( SetWidgetLocation, Float, X, ScreenLocation.x ); WB_SET_AUTO( SetWidgetLocation, Float, Y, ScreenLocation.y ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetLocation, NULL ); } { WB_MAKE_EVENT( SetWidgetAlpha, NULL ); WB_SET_AUTO( SetWidgetAlpha, Hash, Screen, m_UIScreenName ); WB_SET_AUTO( SetWidgetAlpha, Hash, Widget, m_UIWidgetName ); WB_SET_AUTO( SetWidgetAlpha, Float, Alpha, Alpha ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetAlpha, NULL ); } }
/*static*/ void Framework3D::RendererRestoreDeviceCallback(void* pVoid) { Framework3D* pFramework3D = static_cast<Framework3D*>(pVoid); if (pFramework3D) { WB_MAKE_EVENT(ResetRenderer, NULL); WB_DISPATCH_EVENT(pFramework3D->GetEventManager(), ResetRenderer, pFramework3D); } }
/*virtual*/ void WBActionEldGoToLevel::Execute() { WBAction::Execute(); EldritchGame* const pGame = EldritchFramework::GetInstance()->GetGame(); ASSERT( pGame ); WBEventManager* const pEventManager = WBWorld::GetInstance()->GetEventManager(); ASSERT( pEventManager ); if( m_GoToNextLevel ) { WB_MAKE_EVENT( GoToNextLevel, NULL ); WB_LOG_EVENT( GoToNextLevel ); WB_DISPATCH_EVENT( pEventManager, GoToNextLevel, pGame ); } else if( m_GoToPrevLevel ) { WB_MAKE_EVENT( GoToPrevLevel, NULL ); WB_LOG_EVENT( GoToPrevLevel ); WB_DISPATCH_EVENT( pEventManager, GoToPrevLevel, pGame ); } else if( m_ReturnToHub ) { WB_MAKE_EVENT( ReturnToHub, NULL ); WB_LOG_EVENT( ReturnToHub ); WB_SET_AUTO( ReturnToHub, Bool, Restart, m_Restart || m_FullRestart ); WB_SET_AUTO( ReturnToHub, Bool, FlushHub, m_FullRestart ); WB_DISPATCH_EVENT( pEventManager, ReturnToHub, pGame ); } else { WB_MAKE_EVENT( GoToLevel, NULL ); WB_LOG_EVENT( GoToLevel ); WB_SET_AUTO( GoToLevel, Hash, Level, m_Level ); WB_SET_AUTO( GoToLevel, Hash, WorldDef, m_WorldDef ); WB_DISPATCH_EVENT( pEventManager, GoToLevel, pGame ); } if( m_Immediate ) { WB_MAKE_EVENT( GoToLevelImmediate, NULL ); WB_LOG_EVENT( GoToLevelImmediate ); WB_DISPATCH_EVENT( pEventManager, GoToLevelImmediate, pGame ); } }
/*virtual*/ void WBActionUIPushScreen::Execute() { // We can't push directly to the UI stack because we don't know anything about Framework3D // or whoever else might own a UI manager and stack. Instead, use Workbench events. WB_MAKE_EVENT( PushUIScreen, NULL ); WB_SET_AUTO( PushUIScreen, Hash, Screen, m_ScreenName ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), PushUIScreen, NULL ); }
void WBCompEldAnchor::Unanchor() { ASSERT( m_IsAnchored ); m_IsAnchored = false; WB_MAKE_EVENT( OnUnanchored, GetEntity() ); WB_DISPATCH_EVENT( GetEventManager(), OnUnanchored, GetEntity() ); }
void WBCompEldSleeper::Wake() { if (m_IsAwake) { return; } m_IsAwake = true; WB_MAKE_EVENT(OnWoken, GetEntity()); WB_DISPATCH_EVENT(GetEventManager(), OnWoken, GetEntity()); }
void WBCompEldPickup::SellItemTo( WBEntity* const pEntity ) { DEVASSERT( pEntity ); sm_PurchasePickup = this; sm_Purchaser = pEntity; WBCompEldWallet* const pWallet = GET_WBCOMP( pEntity, EldWallet ); ASSERT( pWallet ); const bool CanAfford = ( pWallet->GetMoney() >= m_Price ); STATICHASH( Purchase ); STATICHASH( NameTag ); ConfigManager::SetString( sNameTag, m_FriendlyName.CStr(), sPurchase ); STATICHASH( ItemDesc ); ConfigManager::SetString( sItemDesc, m_FriendlyDesc.CStr(), sPurchase ); STATICHASH( PriceTag ); ConfigManager::SetInt( sPriceTag, m_Price, sPurchase ); STATIC_HASHED_STRING( PurchaseScreen ); STATIC_HASHED_STRING( PurchaseBuyButton ); // Disable the buy button if the price is too high { WB_MAKE_EVENT( SetWidgetDisabled, GetEntity() ); WB_SET_AUTO( SetWidgetDisabled, Hash, Screen, sPurchaseScreen ); WB_SET_AUTO( SetWidgetDisabled, Hash, Widget, sPurchaseBuyButton ); WB_SET_AUTO( SetWidgetDisabled, Bool, Disabled, !CanAfford ); WB_DISPATCH_EVENT( GetEventManager(), SetWidgetDisabled, NULL ); } // Show the purchase screen { WB_MAKE_EVENT( PushUIScreen, GetEntity() ); WB_SET_AUTO( PushUIScreen, Hash, Screen, sPurchaseScreen ); WB_DISPATCH_EVENT( GetEventManager(), PushUIScreen, NULL ); } }
void WBCompEldHands::HideWeaponAltHUD() const { STATIC_HASHED_STRING( HUD ); STATIC_HASHED_STRING( WeaponAltIcon ); WB_MAKE_EVENT( SetWidgetHidden, NULL ); WB_SET_AUTO( SetWidgetHidden, Hash, Screen, sHUD ); WB_SET_AUTO( SetWidgetHidden, Hash, Widget, sWeaponAltIcon ); WB_SET_AUTO( SetWidgetHidden, Bool, Hidden, true ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetHidden, NULL ); }
void WBCompEldHands::SetHandMeshes( const SimpleString& LeftHandMesh, const SimpleString& LeftHandTexture, const SimpleString& RightHandMesh, const SimpleString& RightHandTexture ) const { { WB_MAKE_EVENT( SetMesh, GetEntity() ); WB_SET_AUTO( SetMesh, Hash, Mesh, LeftHandMesh ); WB_SET_AUTO( SetMesh, Hash, Texture, LeftHandTexture ); WB_DISPATCH_EVENT( GetEventManager(), SetMesh, GetLeftHand() ); } { WB_MAKE_EVENT( SetMesh, GetEntity() ); WB_SET_AUTO( SetMesh, Hash, Mesh, RightHandMesh ); WB_SET_AUTO( SetMesh, Hash, Texture, RightHandTexture ); WB_DISPATCH_EVENT( GetEventManager(), SetMesh, GetRightHand() ); } }
void EldritchGame::SetUIReturnToHubDisabled( const bool Disabled ) { STATIC_HASHED_STRING( PauseScreen ); STATIC_HASHED_STRING( PausedReturnButton ); WB_MAKE_EVENT( SetWidgetDisabled, NULL ); WB_SET_AUTO( SetWidgetDisabled, Hash, Screen, sPauseScreen ); WB_SET_AUTO( SetWidgetDisabled, Hash, Widget, sPausedReturnButton ); WB_SET_AUTO( SetWidgetDisabled, Bool, Disabled, Disabled ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetDisabled, NULL ); }
void WBCompEldLock::Unlock() { m_Locked = false; EldritchPersistence* const pPersistence = GetGame()->GetPersistence(); ASSERT( pPersistence ); pPersistence->AddOpenLock( m_Key ); WB_MAKE_EVENT( OnUnlocked, GetEntity() ); WB_LOG_EVENT( OnUnlocked ); WB_DISPATCH_EVENT( GetEventManager(), OnUnlocked, GetEntity() ); }
// Borrowed from WBCompEldItem spawn drop code. Maybe unify? /*virtual*/ void WBActionEldSpawnEntity::Execute() { WBAction::Execute(); WBEntity* const pEntity = GetOwner(); WBParamEvaluator::SPEContext PEContext; PEContext.m_Entity = pEntity; m_EntityDefPE.Evaluate( PEContext ); const SimpleString EntityDef = ( m_EntityDefPE.GetType() == WBParamEvaluator::EPT_String ) ? m_EntityDefPE.GetString() : m_EntityDef; WBEntity* const pSpawnedEntity = WBWorld::GetInstance()->CreateEntity( EntityDef ); WBCompEldTransform* const pSpawnedTransform = pSpawnedEntity->GetTransformComponent<WBCompEldTransform>(); ASSERT( pSpawnedTransform ); WBCompOwner* const pSpawnedOwner = GET_WBCOMP( pSpawnedEntity, Owner ); if( pSpawnedOwner ) { pSpawnedOwner->SetOwner( pEntity ); } Vector SpawnLocation; Vector SpawnImpulse; Angles SpawnOrientation; GetSpawnTransform( pSpawnedEntity, SpawnLocation, SpawnImpulse, SpawnOrientation ); pSpawnedTransform->SetLocation( SpawnLocation ); pSpawnedTransform->SetOrientation( SpawnOrientation ); pSpawnedTransform->ApplyImpulse( SpawnImpulse ); WB_MAKE_EVENT( OnInitialOrientationSet, pSpawnedEntity ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), OnInitialOrientationSet, pSpawnedEntity ); // Notify instigator that we spawned this thing WB_MAKE_EVENT( OnSpawnedEntityAction, GetEntity() ); WB_SET_AUTO( OnSpawnedEntityAction, Entity, SpawnedEntity, pSpawnedEntity ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), OnSpawnedEntityAction, GetEntity() ); }
void Framework3D::ResetRenderer() { XTRACE_FUNCTION; if (m_Renderer->Reset()) { // TODO: RefreshDisplay also resets the renderer--could that be problematic? WB_MAKE_EVENT(RefreshDisplay, NULL); WB_DISPATCH_EVENT(GetEventManager(), RefreshDisplay, this); } else { // Defer the command WB_MAKE_EVENT(ResetRenderer, NULL); WB_QUEUE_EVENT(GetEventManager(), ResetRenderer, this); } }
/*virtual*/ void WBActionEldTweetRIP::Execute() { WBAction::Execute(); EldritchGame* const pGame = EldritchFramework::GetInstance()->GetGame(); ASSERT(pGame); WBEventManager* const pEventManager = WBWorld::GetInstance()->GetEventManager(); ASSERT(pEventManager); WB_MAKE_EVENT(TweetRIP, NULL); WB_LOG_EVENT(TweetRIP); WB_DISPATCH_EVENT(pEventManager, TweetRIP, pGame); }
/*virtual*/ void WBActionEldSetPersistentVar::Execute() { WBAction::Execute(); WBParamEvaluator::SPEContext PEContext; PEContext.m_Entity = GetEntity(); m_ValuePE.Evaluate( PEContext ); WB_MAKE_EVENT( SetPersistentVar, NULL ); WB_SET_AUTO( SetPersistentVar, Hash, Name, m_Key ); WB_SET_AUTO_PE( SetPersistentVar, Value, m_ValuePE ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetPersistentVar, NULL ); }
void WBCompEldMesh::OnAnimationFinished(class Mesh* pMesh, class Animation* pAnimation, bool Interrupted) { Unused(pMesh); ASSERT(pAnimation); ASSERT(pMesh == m_Mesh); WB_MAKE_EVENT(OnAnimationFinished, GetEntity()); WB_SET_AUTO(OnAnimationFinished, Hash, AnimationName, pAnimation->m_HashedName); WB_SET_AUTO(OnAnimationFinished, Bool, Interrupted, Interrupted); WB_DISPATCH_EVENT(GetEventManager(), OnAnimationFinished, GetEntity()); }
/*virtual*/ void WBActionUISetWidgetImage::Execute() { WBParamEvaluator::SPEContext PEContext; PEContext.m_Entity = GetEntity(); m_ImagePE.Evaluate( PEContext ); const HashedString Image = ( m_ImagePE.GetType() == WBParamEvaluator::EPT_String ) ? m_ImagePE.GetString() : m_Image; WB_MAKE_EVENT( SetWidgetImage, NULL ); WB_SET_AUTO( SetWidgetImage, Hash, Screen, m_ScreenName ); WB_SET_AUTO( SetWidgetImage, Hash, Widget, m_WidgetName ); WB_SET_AUTO( SetWidgetImage, Hash, Image, Image ); WB_DISPATCH_EVENT( WBWorld::GetInstance()->GetEventManager(), SetWidgetImage, NULL ); }
RodinBTNode::ETickStatus RodinBTNodeEldLookAt::Tick(float DeltaTime) { Unused(DeltaTime); WBEntity* const pEntity = GetEntity(); WBCompRodinBlackboard* const pAIBlackboard = GET_WBCOMP(pEntity, RodinBlackboard); ASSERT(pAIBlackboard); const WBEvent::EType TargetType = pAIBlackboard->GetType(m_LookTargetBlackboardKey); if (TargetType == WBEvent::EWBEPT_Vector) { const Vector LookTarget = pAIBlackboard->GetVector(m_LookTargetBlackboardKey); WB_MAKE_EVENT(LookAt, pEntity); WB_SET_AUTO(LookAt, Vector, LookAtLocation, LookTarget); WB_DISPATCH_EVENT(GetEventManager(), LookAt, pEntity); return ETS_Success; } else if (TargetType == WBEvent::EWBEPT_Entity) { WBEntity* const pLookTargetEntity = pAIBlackboard->GetEntity(m_LookTargetBlackboardKey); if (!pLookTargetEntity) { return ETS_Fail; } WB_MAKE_EVENT(LookAt, pEntity); WB_SET_AUTO(LookAt, Entity, LookAtEntity, pLookTargetEntity); WB_DISPATCH_EVENT(GetEventManager(), LookAt, pEntity); return ETS_Success; } return ETS_Fail; }
void WBCompEldWatson::TickUnactivated() { WBEntity* const pPlayer = EldritchGame::GetPlayer(); ASSERT( pPlayer ); WBCompEldSensorVision* const pVision = GET_WBCOMP( GetEntity(), EldSensorVision ); ASSERT( pVision ); if( pVision->IsVisible( pPlayer ) ) { m_Activated = true; WB_MAKE_EVENT( OnWatsonActivated, GetEntity() ); WB_DISPATCH_EVENT( GetEventManager(), OnWatsonActivated, GetEntity() ); } }
void WBCompEldFrobbable::SetIsFrobTarget(const bool IsFrobTarget, WBEntity* const pFrobber) { m_IsProbableFrobbable = IsFrobTarget; WB_MAKE_EVENT(OnBecameFrobTarget, GetEntity()); WB_SET_AUTO(OnBecameFrobTarget, Bool, IsFrobTarget, m_IsProbableFrobbable); WB_SET_AUTO(OnBecameFrobTarget, Entity, Frobber, pFrobber); WB_SET_AUTO(OnBecameFrobTarget, Vector, Highlight, m_Highlight); WB_DISPATCH_EVENT(GetEventManager(), OnBecameFrobTarget, GetEntity()); if (IsFrobTarget) { PublishToHUD(); } else { SetHUDHidden(true); } }