OutputChangeType (abstract) : ScriptableObject


View on GitHub

An OutputChangeType is an abstract base class that inherits from ScriptableObject. It is used by an OutputChange to define its logic and the data it needs for that logic. An OutputChange is used Mapping Types, Entity Triggers, and World Object Type's State Transitions to make any kind of change. The classes that inherit from this are the ones that are actually plugged into an Output Change.

For example, DriveLevelOCT inherits from OutputChangeType and has logic for changing an Agent or Target Agent's Drive Level. The specific Drive Type and amount to change the level by is set in the Output Change.

View DriveLevelOCT on GitHub

Public Fields



  public TypeInfo typeInfo;
          
Should be created inside OnEnable by the subclass to provide a description and field usage info to the Editor.

Abstract Methods



  public abstract bool MakeChange(Agent agent, Entity target, OutputChange outputChange,
                                  Mapping mapping, float actualAmount, out bool forceStop);
          
Entity target will depend on the TargetType selected in the OutputChange. It can be the mapping's Entity Target (ToEntityTarget), Inventory Target (ToInventoryTarget), or the Agent running this (ToSelf).

actualAmount will come from the OTC's CalculateAmount method (see below). It needs to be calculated separately for planning and also so it can be passed into the ChangeConditions.

Virtual Methods



  public virtual float CalculateAmount(Agent agent, Entity target, OutputChange outputChange,
                                       Mapping mapping)
  {
      return 0f;
  }
          

  public virtual float CalculateSEUtility(Agent agent, Entity target, OutputChange outputChange,
                                          Mapping mapping, DriveType mainDriveType, float amount)
  {
      return 0f;
  }
          

  public virtual bool Match(Agent agent, OutputChange outputChange,
                            MappingType outputChangeMappingType, InputCondition inputCondition,
                            MappingType inputConditionMappingType)
  {
      return false;
  }
          

  public virtual bool PreMatch(OutputChange outputChange, MappingType outputChangeMappingType,
                               InputCondition inputCondition, MappingType inputConditionMappingType,
                               List allEntityTypes)
  {
      return true;
  }