Class AttitudeView

All Implemented Interfaces:
IBlackboardView<AttitudeView>

public class AttitudeView extends PrioritisedProviderView<IAttitudeProvider, AttitudeView>
A singleton blackboard view used entirely to compute the relationship between an NPC and another entity.

Multiple possible providers implementing IAttitudeProvider can be registered with varying levels of priority in order to allow the computation to be flexibly defined for multiple purposes. Beyond the Attitude returned, NPCs don't care about the inner workings of these providers.

Examples of providers could include:

  • Reputation system
  • Local NPC memory
  • Evaluation based on player teams
  • Evaluation based on other NPC species
  • Constructor Details

    • AttitudeView

      public AttitudeView(World world)
  • Method Details

    • getAttitude

      @Nonnull public Attitude getAttitude(@Nonnull Ref<EntityStore> ref, int sourceRoleIndex, @Nonnull Ref<EntityStore> target, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • isOutdated

      public boolean isOutdated(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store)
      Description copied from interface: IBlackboardView
      Checks whether the current view is outdated for the given NPC and if they need to fetch a new one
      Parameters:
      ref - The entity reference of the NPC
      store - The entity store for component access
      Returns:
      whether they need to query for a new view
    • getUpdatedView

      public AttitudeView getUpdatedView(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Description copied from interface: IBlackboardView
      Returns the updated view if the current is outdated
      Parameters:
      ref - The NPC seeking a view
      componentAccessor - The ComponentAccessor for component access
      Returns:
      the updated view
    • initialiseEntity

      public void initialiseEntity(@Nonnull Ref<EntityStore> ref, @Nonnull BlackboardSubscription subscription)
      Description copied from interface: IBlackboardView
      Initializes the given entity with any data relevant to the view.
      Parameters:
      ref - The entity reference
      subscription - The BlackboardSubscription holding the entity's subscribed sets
    • cleanup

      public void cleanup()
      Description copied from interface: IBlackboardView
      Perform whatever cleanup is necessary in this view at a regular interval
    • onWorldRemoved

      public void onWorldRemoved()
      Description copied from interface: IBlackboardView
      Perform any final cleanup when the world is removed